Returns or sets the number of milliseconds a request can take before automatically being terminated.
var result = element.timeout; element.timeout = value;
Returns an object of type unsigned longunsigned long
// The following example sets the timeout property var xhr = new XMLHttpRequest(); xhr.open("GET", "http://localhost/books.xml", true); xhr.timeout = 10000; xhr.ontimeout = timeoutFired; xhr.send(null);
The timeout property has a default value of 0. If the time-out period expires, the responseText property will be null. You should set a time-out value that is slightly longer than the expected response time of the request. The timeout property may be set only in the time interval between a call to the open method and the first call to the send method. If you set an XMLHttpRequest time-out value that is larger than the network stack’s time-out value, the network stack will time out first and the ontimeout event will not be raised.
- W3C XMLHttpRequest Specification
- W3C Working Draft
Microsoft Developer Network: Windows Internet Explorer API reference Article