Развернуть
timeout Property
New for Windows Internet Explorer 8

Gets or sets the time-out value.

Syntax

[ v = ] object.timeout [ = v ]

Possible Values

vInteger that specifies or receives the number of milliseconds that the browser is to wait for a server response.

The property is read/write. The property has a default value of 0.

Possible Exceptions

Unspecified error (0x80004005) The time-out was set before the open method was called or after the send method was called.
Invalid procedure call or argument (0x800A0005) The time-out was set to a negative value.

Remarks

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.

Example

The following example sets the timeout property.


var xhr;
xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.timeout = 10000;
xhr.ontimeout = timeoutFired;
xhr.send(null);

Standards Information

There is no public standard that applies to this property.

Applies To

XMLHttpRequest, XMLHttpRequest Constructor

See Also

Содержимое сообществаДобавить
Page view tracker