1 XMLHTTP is a set of APIs that transmit or receive XML and other data through the HTTP protocol in JavaScript scripting languages.
(XMLHTTP is a set of APIs that transmit and receive data through the HTTP protocol.) )
2 XMLHTTP provides a protocol for client communication with the HTTP server, which sends a request to the HTTP server via the XMLHTTP object (msxml2.xmlhttp.3.0) and uses the DOM to process the response.
2.1 XMLHTTP objects are created in a way that distinguishes IE and non-IE browsers:
Example: Create a XMLHTTP object and request an XML document from the server, which is displayed after the document is returned. The following are examples of IE and non-IE explained
1 IE Browser uses ActiveXObject method to create XMLHTTP objects:
var xmlhttpreq = new ActiveXObject ("msxml2.xmlhttp.3.0");
Xmlhttpreq.open ("Get", "Http://localhost/test.xml", false);
Xmlhttpreq.send ();
alert (Xmlhttpreq.responsetext);
2 non-IE browsers use the XMLHttpRequest method to create XMLHTTP objects:
var xmlhttpreq = new XMLHttpRequest ();
Xmlhttpreq.open ("Get", "Http://localhost/test.xml", false);
Xmlhttpreq.send ();
alert (Xmlhttpreq.responsetext);
2.2 after the XMLHttp object is created, because it is a set of APIs, it has a number of methods and properties, such as the Open (), send (), and responsetext used above.
The XMLHTTP object's code is handled in a more fixed way. So the next thing to do is to follow the example in order to understand it.
The biggest benefit of the 3 XMLHTTP is that updating parts of the page does not require refreshing the entire page.