Click to Rate and Give Feedback
Properties
 readyState Property
readyState Property

Retrieves the current state of the request operation.

Syntax

[ nState = ] XMLHttpRequest.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 status and response headers are not fully available. 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 World Wide Web link 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

See Also

onreadystatechange
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker