/*ajax Asynchronous Commit */
/*1. Declaring an AJAX global variable */
var ajaxrequest;
function Checkajax () {
/*2. Creating xmlhttprequest*/
Ajaxrequest=new XMLHttpRequest ();
/*3. Configuring the Request Object */
var url= "user.do?uname=" +$ ("uname"). Value () + "times=" +new Date (). getmilliseconds ();
/* Solve garbled problem, backstage with Urldecoder.decode (uname,, "" utf-8) */
Url=encodeuri (URL);
Url=encodeuri (URL);
/* Turn on request */
/*/!*post Submit the code below *!/
Ajaxrequest.setrequestheader ("Content-type", "appplication/x-www-form-urlencoded"); */
Ajaxrequest.open ("GET", url,true);
/*4. Preparing the Send status--ajax*/
Ajaxrequest.onreadystatechange=function () {
/* Judge status as Ajax, normal response */
if (ajaxrequest.readystate==4&&ajaxrequest.status==200) {
$ ("result"). Innerhtml=ajaxrequest.responsetext;
}
}
/*get method Send (NULL) Fill Null,post method fill variable send (num) */
Ajaxrequest.send (NULL);
}
}
Ajax asynchronous Commit (Frontend)