Slimtugo
Slimtugo

Reputation: 97

Adding a Timeout Function to jXHR.js

How can i add a timeout function to jXHR.js available from: http://mulletxhr.com/

Thanks.

Upvotes: 0

Views: 264

Answers (1)

Sarfraz
Sarfraz

Reputation: 382726

It has SETTIMEOUT, see its source code here:

http://mulletxhr.com/jXHR.js

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

Related Questions