Wednesday, October 17, 2012

jquery ajax readyState

The readyState  property holds the status of the  XMLHttpRequest, the following are the possible values for the readyState property.

0: request not initialized 
1: server connection established
2: request received 
3: processing request 
4: request finished and response is ready

In legacy applications we will have to monitor the value of the readyState property and wait till it becomes 4, however jQuery now provides handlers like ajaxStart, ajaxStop, ajaxComplete & ajaxSuccess, hence we need to keep monitoring the value of readyState to know when the request gets completed.

However jQuery Ajax still supports this property for backward compatibility, we can attach a onreadystatechange hander to the XMLHttpRequest object and monitor the state of the request.

Related Post

jquery ajax status
jquery ajax status example
jquery ajax readyState
jquery ajax readyState example
jquery ajax caching
jquery ajax caching example
jquery ajax async
jquery ajax async example
jquery ajax authentication
jquery ajax authentication example

Search Flipkart Products:

No comments: