<SCRIPT type = "text/JavaScript">
VaR XMLHTTP;
// Create an xhr object first
Function createxmlhttprequest (){
// For IE, activexobject
If (window. activexobject ){
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
// If other browsers use XMLHttpRequest
Else if (window. XMLHttpRequest ){
XMLHTTP = new XMLHttpRequest ();
}
}
// Start the Function
Function startrequest (){
Createxmlhttprequest ();
// Specify the function to be executed when the readystate attribute changes
XMLHTTP. onreadystatechange = handlestatechange;
// Create an HTTP request and specify the method, URL, and authentication information of the request.
XMLHTTP. Open ("get", "simpleresponse. xml", true );
// Send the request to the HTTP server and receive the response
XMLHTTP. Send (null );
}
Function handlestatechange (){
// 4. The data has been received
If (XMLHTTP. readystate = 4 ){
// 200 the returned Request status is OK
If (XMLHTTP. Status = 200 ){
// In the displayed dialog box, enter the text content of the simpleresponse. xml file.
Alert ("the server replied with:" + XMLHTTP. responsetext );
}
}
}
</SCRIPT>