I got a bug report that I can\'t duplicate, but ajax-call timeout is the current best guess.
So I\'m trying to find out the default value for timeout of a jQuery
There doesn't seem to be a standardized default value. I have the feeling the default is 0
, and the timeout event left totally dependent on browser and network settings.
For IE, there is a timeout property for XMLHTTPRequests here. It defaults to null, and it says the network stack is likely to be the first to time out (which will not generate an ontimeout event by the way).
The XMLHttpRequest.timeout
property represents a number of milliseconds a request can take before automatically being terminated. The default value is 0
, which means there is no timeout. An important note the timeout shouldn't be used for synchronous XMLHttpRequests
requests, used in a document environment or it will throw an InvalidAccessError
exception. You may not use a timeout for synchronous requests with an owning window.
IE10 and 11 do not support synchronous requests, with support being phased out in other browsers too. This is due to detrimental effects resulting from making them.
More info can be found here.
As an aside, when trying to diagnose a similar bug I realised that jquery's ajax error callback returns a status of "timeout" if it failed due to a timeout.
Here's an example:
$.ajax({
url: "/ajax_json_echo/",
timeout: 500,
error: function(jqXHR, textStatus, errorThrown) {
alert(textStatus); // this will be "timeout"
}
});
Here it is on jsfiddle.
there is no timeout, by default.