We all know that Ajax refers to a small amount of data interaction with the server without the need for a refresh, which allows the page content to be updated without refreshing. The core object of Ajax is XMLHttpRequest , XMLHttpRequest objects are well supported in all modern browsers and can be used directly. You need to use a specific constructor , ActiveXObject (), to create the IE7 previous browser.
Using the XMLHttpRequest object only needs to build an instance, as follows:
var New XMLHttpRequest ();
The object instance that we created is something that can be printed out to look at.
The first step in using the XHR object is to use the open () method, which has three parameters, the first parameter is the type that needs to send the request (Post/get), the second parameter is the requested server address, and the third parameter refers to whether the request is asynchronous or synchronous, as follows:
Xhr.open ("Get", "01.php",false);
The above code initiates a get-way asynchronous request to a 01.php file, but this step does not actually send the request, just means that the request is ready, the sending request needs another method send () , the Send () method receives a parameter, This parameter is the data that needs to be sent, and if you do not need to send the data, null is passed in
Understanding XMLHttpRequest Objects