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?