Five states of Ajax (ReadyState)
0-(uninitialized) has not yet called the Send () method
1-(load) called the Send () method, sending the request
2-(loading complete) the Send () method executes and has received the full response content
3-(interactive) parsing response content
4-(complete) The response content resolution is complete and can be invoked on the client
readyState Status description
(0) not initialized
This phase confirms that the XMLHttpRequest object was created and did not call the open () method to prepare for an uninitialized transition. A value of 0 indicates that the object already exists, or the browser will error---object does not exist.
(1) Loading
This phase initializes the XML (normalized closer) HttpRequest object, which is called the Open () method, which sets the object state based on the parameter (method,url,true). and call the Send () method to start sending requests to the server. A value of 1 indicates that a request is being sent to the server.
(2) Loading completed
This stage receives server-side response data. However, only the raw data of the server response is obtained, and it cannot be used directly on the client. A value of 2 indicates that the full-part response data has been received. and prepare for the next phase of data parsing.
(3) Interactive
This phase resolves the received server-side response data. That is, the data is converted into a format that can be accessed through responsebody, ResponseText, or responsexml (normalized closer) properties based on the MIME type returned by the server-side response header, ready for client invocation. State 3 indicates that the data is being parsed.
(4) Complete
This phase confirms that all data has been resolved to the format available to the client, and the parsing is complete. A value of 4 means that the data is parsed and data can be obtained from the corresponding properties of the HttpRequest object through XML (normalization is getting closer).
Five states of Ajax