This time I will bring you the core working principle and objects of Ajax. What are the core working principles and objects to pay attention to when using Ajax. The following is a practical case, let’s take a look.
The working principle of ajax:
The working principle of ajax is equivalent to adding an intermediate layer (ajax engine) between the user and the server, making the user operation and server response asynchronous. Not all user requests are submitted to the server. Only when it is determined that new data needs to be read from the server, the ajax engine submits the request to the server on its behalf.
The core of ajax:
It consists of javascript, XMLHT TPRequest, and DOM objects. It makes asynchronous requests to the server through the XMLHTTPRequest object, obtains data from the server, and then uses javascript to operate the DOM to update the page. The most critical step in this is to obtain the request data from the server.
XMLHTTPRequest object:
The biggest feature of AJAX is that it can transmit or read and write data to the server without refreshing the page. This feature mainly benefits from the XMLHTTPRequest object of the XMLHTTP component.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Three ways to maintain JS code
The above is the detailed content of The core of how Ajax works and its objects. For more information, please follow other related articles on the PHP Chinese website!