1 xmlHttp is an API for transmitting or receiving XML and other data through Http in JavaScript scripting.
(XmlHttp is an API for transmitting and receiving data through Http .)
2 xmlHttp provides the protocol for communication between the client and the http server. The client sends a request to the http server through the xmlHttp object (MSXML2.XMLHTTP. 3.0) and uses DOM to process the response.
2.1 create an xmlHttp object by using IE and non-ie browsers:
Example: Create an xmlHttp object and request an xml document from the server. The returned document is displayed. The following is an example of IE and non-IE respectively.
1) Use ActiveXObject to create an xmlHttp object in IE:
VarXmlHttpReq =New ActiveXObject ("MSXML2.XMLHTTP. 3.0 ");
XmlHttpReq. open ("GET", "http: // localhost/test. xml", false );
XmlHttpReq. send ();
Alert (xmlHttpReq. responseText );
2) create an xmlHttp object using XMLHttpRequest in a non-IE browser:
VarXmlHttpReq =New XMLHttpRequest ();
XmlHttpReq. open ("GET", "http: // localhost/test. xml", false );
XmlHttpReq. send ();
Alert (xmlHttpReq. responseText );
2.2CreatedXMLHttpObject, because it is a setAPITherefore, it has many methods and attributes, such as open (), send (), and responseText used above.
The code processing method for xmlHttp objects is relatively fixed. Therefore, the following is just an example to understand.
3. The biggest advantage of xmlHttp is that you do not need to refresh the whole page when updating part of the page content.