var havereturn=false;
function ontimeout(){
if(!havereturn){
//还没返回,
alert("连接超时");
havereturn=true;
//也许有什么办法让xmlhttp停下来,可以写在这,不停也没关系。
//window.clearTimeout();
//ajax.abort();
//ajax = null;
//delete ajax;
}
}
function doYourAjax(){//------你的ajax请求
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
xmlhttp.onreadystatechange=function(){
if (xhr.readyState == 4) {
if (xhr.status == 200) {
if(!havereturn){
//你处理返回结果的代码
var res = xmlhttp.responseText;
alert(res);
}
}
havereturn=true;
}
}
havereturn=false;
xmlhttp.Open("POST", "www.javaeye.com");
setTimeout("ontimeout()",5000);//5秒后执行ontimeout
xmlhttp.Send(data);
}//--------- Smilar Posts of ajax overtime
-
Ajax Portal
The first test procedure: Institute of Reconstruction: Then look at page after reconfiguration code, the advantages of its own Oh comprehend:
-
tomcat6.0 + myeclipse6.5 under tomcat data source configuration
(1) Environment: such as a very important question! Different environment, different configurations! (2) struts package loaded: My MyEclipse6.5 bring him under the load of the struts jar package Error ...
-
extjs development environment set up and practice
1, download and extract the extjs 2, download eclipse and Eclipse AJAX Toolkit Framework (ATF) I have been accustomed to using eclipse as a development environment, a variety of open-source plugin so ...
-
Msxml2.XMLHTTP version problem
Projects with an import feature prototype.js of Ajax functionality to update the prompt, the code is very simple, do not have the framework of the background on a jsp to output Text, future use of tim ...
-
Depth understanding of the eval function in javascript
http://wanyij.blog.51cto.com/46570/43794 In this paper, the discovery of an appropriate title is not so easy, huh, huh, so in this note under the first two purposes of this article: (1) introduction o ...
-
JS after ajax request return of the problem can not be implemented
1: Send ajax request, in the onComplete, if back when the html contains a javascript, then these javascrip and will not be realized, it does not mean not to implement. This problem has troubled me for ...
-
JS charts extjs implementation tools can be combined
OpenFlashChart brief introduction by valensoft 2009-1-10 8:29:00 OpenFlashChart is an open source Flash and Javascript to the technical foundation for the free chart, using it to create some very usef ...







