Properties


readyState Property

Retrieves the current state of the request operation.

Syntax

[ nState = ] object.readyState

Possible Values

nStateInteger that receives one of the following values.
0 (Uninitialized)
The object has been created, but not initialized (the open method has not been called).
1 (Open)
The object has been created, but the send method has not been called.
2 (Sent)
The send method has been called. responseText is not available. responseBody is not available.
3 (Receiving)
Some data has been received. responseText is not available. responseBody is not available.
4 (Loaded)
All the data has been received. responseText is available. responseBody is available.

The property is read-only. The property has no default value.

Remarks

You cannot call responseBody and responseText properties to obtain partial results (readyState = 3). Doing so will return an error, because the response is not fully received. You must wait until all data has been received.

In comparison, the Microsoft XML (MSXML) version of the IXMLHTTPRequest interface exposes partial results through the responseStream property, which the Windows Internet Explorer native version does not implement. Be aware that this behavior also differs from the IServerXMLHTTPRequest interface, which provides partial results to responseBody and responseText.

readyState was introduced in Internet Explorer 7.

Standards Information

This property is defined in The XMLHttpRequest Object (W3C Working Draft) World Wide Web link.

Applies To

XMLHttpRequest, XMLHttpRequest Constructor

See Also

onreadystatechange
Tags :


Page view tracker