Five states of Ajax

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.