From http://www.ajaxsamples.cn/html/6405.html
Attributes of the XMLHTTPRequest object:
Onreadystatechange the event handler of the event triggered by each state change.
The string format of responsetext returned data from the server process.
Responsexml is a dom-compatible document data object returned by the server process.
Status Code returned from the server, such as common 404 (not found) and 200 (ready)
String information of the Status text accompanied by the status code
Readystate object status value
0 (not initialized) the object has been created, but has not been initialized (the open method has not been called)
1 (initialization) the object has been created and the send method has not been called
2 (send data) The send method has been called, but the current status and HTTP header are unknown.
3 (in data transmission) Some data has been received. Because the response and HTTP headers are incomplete, an error occurs when retrieving part of data through responsebody and responsetext,
4. After receiving the data, you can use responsexml and responsetext to obtain the complete response data.
Simple Example:
Function createxmlhttp () <br/>{< br/> // create an XMLHTTPRequest object in a non-IE browser <br/> If (window. XMLHttpRequest) <br/>{< br/> XMLHTTP = new XMLHttpRequest (); <br/>}< br/> // create an XMLHTTPRequest object in IE browser <br/> If (window. activexobject) <br/>{< br/> try <br/>{< br/> XMLHTTP = new activexobject ("Microsoft. XMLHTTP "); <br/>}< br/> catch (E) <br/>{< br/> try <br/>{< br/> XMLHTTP = new activexobject ("msxml2.xmlhttp"); <br/>}< B R/> catch (Ex) {}< br/>}< br/> function ajaxrequst () <br/>{< br/> createxmlhttp (); <br/> If (! XMLHTTP) <br/>{< br/> alert ("An error occurred while creating the XMLHTTP object! "); <Br/> return false; <br/>}< br/> XMLHTTP. open ("Post", "ABC. XML ", true); <br/> XMLHTTP. onreadystatechange = function () <br/>{< br/> If (XMLHTTP. readystate = 4) <br/>{< br/> If (XMLHTTP. status = 200) <br/>{< br/> document. write (XMLHTTP. responsexml); <br/>}< br/> XMLHTTP. send (null); <br/>}