Reputation: 97
How can i add a timeout function to jXHR.js available from: http://mulletxhr.com/
Thanks.
Upvotes: 0
Views: 264
Reputation: 382726
It has SETTIMEOUT
, see its source code here:
It us used there in send
function. Search for send:
there.
Update:
Modify this function in the jXHR.js
file:
send:function(){
SETTIMEOUT(function(){
scriptElem = doc.createElement("script");
scriptElem.setAttribute("type","text/javascript");
scriptElem.onload = scriptElem.onreadystatechange = function(){handleScriptLoad.call(scriptElem);};
scriptElem.setAttribute("src",script_url);
doc.getElementsByTagName("head")[0].appendChild(scriptElem);
},60000);
fireReadyStateChange(2);
},
See I have added 60000
in above code for 60 seconds, you can modify that as per your needs.
Upvotes: 1