How does Ajax work?

Source: Internet
Author: User

1. We need to know what Ajax is:

AJAX = Asynchronous JavaScript and XML (asynchronous JavaScript and XML).

AJAX is not a new programming language, but a new method of using existing standards.

AJAX is the art of exchanging data with a server and updating parts of a Web page without reloading the entire page.

2, regardless of learning that language, we need to know what it is used to do, Ajax can help us realize the asynchronous refresh function!

3. Let's look at how it works:

Interpretation: Let's look at the results of running in the console first:

onReadyStateChange This step plays the role of listening:

Popular point is that:

onReadyStateChange Monitor ReadyState

Once the ReadyState property changes, it can trigger the execution of the onreadystatechange function! This is what the official told us on the Internet.

Noteworthy: There is some ambiguity on the official website, and we can see that when xhr.readystate = = 4 is complete, the function starts to execute!

Ajax is done in these four steps!

How does Ajax work?

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.