“等待回应” Ajax调用时的消息 [英] "Waiting for response" message when Ajax call

查看:95
本文介绍了“等待回应” Ajax调用时的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在HEAD部分中使用Ajax调用(jquery)时,我在具有旋转圆的chrome浏览器上找到了等待响应消息。我不想看这丑陋的样子。有没有办法避免这种情况?






PS:当我使用input标签调用JavaScript(Ajax调用)函数像

 < input id =launchertype =buttononfocus =go()value =Go! >< /输入> 

我看不到等待的圈子。因为我的程序应该自动调用函数我不能使用这个方法(如果我使用 document.getElementById(launcher).glasses()来自动启动函数,它再次显示了等待循环。)我想有一些不同的上下文来调用JavaScript函数。



更新这里是我的示例代码 p>

 < HEAD> 
< SCRIPT TYPE =text / javascript>
函数go(){
$ .ajax({
url:/ myService,
success:function(data){
document.getElementById(result_area ).innerHTML = data;
go();
}
});

$(document).ready(function(){
go()//这里我想要Comet call;
});
go(); //应该自动启动。
< / SCRIPT>
< / HEAD>
< BODY>
<! - < input id =launchertype =buttononfocus =go()value =Go!>< / input>
这不显示等待的圈子。为什么?使用不同的调用环境? - >
< div id =result_area>< / div>
< / BODY>


解决方案


我发现这个在 XMLHttpRequest 上的等待循环取决于浏览器的实现。在IE7上,Firefox4没有显示任何等待循环或栏,而chrome11,Windows Safari浏览器只有一个。



我认为应该制定标准,因为它对用户体验影响很大。


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>

解决方案

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.

这篇关于“等待回应” Ajax调用时的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆