<Script language = "JavaScript"> var xmlhttpreq; // create the XMLHTTPRequest object function createxmlhttprequest () {If (window. XMLHttpRequest) {// Mozilla xmlhttpreq = new XMLHttpRequest ();} else if (window. activexobject) {// IE browser try {xmlhttpreq = new activexobject ("msxml2.xmlhttp");} catch (e) {try {xmlhttpreq = new activexobject ("Microsoft. XMLHTTP ") ;}catch (e) {}}// send the request function sendrequest (URL) {createxmlhttprequest (); xmlhttpreq. open ("get", URL); xmlhttpreq. onreadystatechange = processresponse; // specify the response function xmlhttpreq. send (null); // send request} // function for processing returned information function processresponse () {If (xmlhttpreq. readystate = 4) {// judge the object state if (xmlhttpreq. status = 200) {// information returned successfully. Start to process information var res = xmlhttpreq. responsetext; window. alert (RES);} else {// The page is abnormal window. alert ("the page you requested has an exception. ") ;}}Ii. Send the POST request var xmlhttpreq; // create the XMLHTTPRequest object function createxmlhttprequest () {If (window. XMLHttpRequest) {// Mozilla xmlhttpreq = new XMLHttpRequest ();} else if (window. activexobject) {// IE browser try {xmlhttpreq = new activexobject ("msxml2.xmlhttp");} catch (e) {try {xmlhttpreq = new activexobject ("Microsoft. XMLHTTP ") ;}catch (e) {}}// send the request function sendrequest (URL, para) {Createxmlhttprequest (); xmlhttpreq. open ("Post", URL, true); xmlhttpreq. onreadystatechange = processresponse; // specify the response function xmlhttpreq. setRequestHeader ("Content-Type", "application/X-WWW-form-urlencoded"); xmlhttpreq. send (para); // send request} // function of processing returned information function processresponse () {If (xmlhttpreq. readystate = 4) {// judge the object state if (xmlhttpreq. status = 200) {// information returned successfully. Start to process information var res = xmlhttpreq. responsetext; Window. Alert (RES);} else {// The page is abnormal. Window. Alert ("the page you requested has an exception. ");}}}