“等待响应” Ajax 调用时的消息
当我在 HEAD 部分使用 Ajax 调用(jquery)时,我在带有旋转圆圈的 Chrome 浏览器上发现“等待响应消息”。我不想要这种丑陋的样子。有办法避免这种情况吗?
PS:当我使用输入标签调用JavaScript(Ajax调用)函数时,
<input id="launcher" type="button" onfocus="go()" value="Go!"></input>
我看不到等待圈。因为我的程序应该自动调用该函数,所以我无法使用此方法。(如果我使用 document.getElementById("launcher").focus()
自动启动该函数,它再次显示等待循环.) 我猜想调用 JavaScript 函数有一些不同的上下文。
更新这是我的示例代码
<HEAD>
<SCRIPT TYPE="text/javascript">
function go() {
$.ajax({
url: "/myService",
success: function(data){
document.getElementById("result_area").innerHTML = data;
go();
}
});
}
$(document).ready(function(){
go() //Here I want to Comet call;
});
go(); //should start automatically.
</SCRIPT>
</HEAD>
<BODY>
<!-- <input id="launcher" type="button" onfocus="go()" value="Go!"></input>
This doesn't show the waiting circle. Why? Use different call context? -->
<div id="result_area"></div>
</BODY>
When I use Ajax call(jquery) in the HEAD section I find a "waiting for response message" on a chrome browser with revolving circle. I don't want this ugly look. Is there a way to avoiding this?
PS: When I use input tag to call the JavaScript(Ajax call) function like
<input id="launcher" type="button" onfocus="go()" value="Go!"></input>
I couldn't see a waiting circle. Cause my program should call the function automatically I couldn't use this method.(If I use document.getElementById("launcher").focus()
to automatically start the function, It showed waiting circle again.) I guess there's a some different context to call JavaScript function.
Update Here is my sample code
<HEAD>
<SCRIPT TYPE="text/javascript">
function go() {
$.ajax({
url: "/myService",
success: function(data){
document.getElementById("result_area").innerHTML = data;
go();
}
});
}
$(document).ready(function(){
go() //Here I want to Comet call;
});
go(); //should start automatically.
</SCRIPT>
</HEAD>
<BODY>
<!-- <input id="launcher" type="button" onfocus="go()" value="Go!"></input>
This doesn't show the waiting circle. Why? Use different call context? -->
<div id="result_area"></div>
</BODY>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一些问题我想强调
一下
,
in ajax 调用您没有
成功:您再次调用
go()
,这闻起来像递归函数之前编写)
我尽力告诉你基本的,这是我的
HTML
jQuery方法
there are some issue i want to highlight
this should be
then
in ajax call you are not writing url link with extension (.php or .html or .js )
in success : you again calling
go()
, this smell like recursive function</body>
)i tried my hard to tell you the basic, here is my way
HTML
jQuery
我发现
XMLHttpRequest
上的等待循环取决于浏览器实现。在 IE7、Firefox4 上,它没有显示任何等待圈或条,而 chrome11、Windows safari 有一个。我认为应该对此制定标准,因为它对用户体验影响很大。
I found that this waiting circle on
XMLHttpRequest
is depend on a browser implementation. On IE7, Firefox4 it didn't show any waiting circle or bar while chrome11, Windows safari had one.I believe that standard on this should be made cause it impacts greatly on user experience.