I am watching ajax recently It needs to be a relatively basic thing, novices can read it New Document <br> <br> if(window.ActiveXObject) //If window declares a function<br> {<br> function XMLHttpRequest() //This function firefox has no declaration <br> {<br> try{<br> //Return object handle<br> return new ActiveXObject("MSXML2.XMLHTTP");<br> return new ActiveXObject("Microsoft.XMLHTTP");<br> } catch (err){<br> alert("XMLHttpRequest error");<br> }<br> }<br> }<br> //Declare an ajax function. This is the ajax entry<br> function ajax(reqtype,url,asynch,respHandle)<br> {<br> $ajax=new XMLHttpRequest(); //new an xmlhttp. Pay attention to this function. Do you need to add var before it to represent global variables? <br> if($ajax) //Check whether new is successful<br> {<br> //Check what type of submission<br> if(reqtype.toLowerCase()!='post'){<br> initReq(reqtype,url,asynch,respHandle); //Call an initialization function<br> } else<br> {<br> var args=arguments[4]; //If it is a post, there should be another parameter <br> if(args!=null&&args.length>0)<br> {<br> initReq(reqtype,url,asynch,respHandle,args); //Call an initialization function<br> }<br> }<br> }else<br> {<br> alert('ajax new error');<br> }<br> }<br> function initReq(reqType,url,bool,respHandle){<br> try{<br> $ajax.onreadystatechange=respHandle; //Set the function to be called if the submission is successful. Note that this is a variable <br> $ajax.open(reqType,url,bool); //Open address<br> if(reqType.toLowerCase()=="post"){ //If it is a post, also send the type<br> $ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");</p> <p align="left"></p> <div style="display:none;"> <span id="url" itemprop="url">http://www.bkjia.com/PHPjc/631924.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">true</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http: //www.bkjia.com/PHPjc/631924.html</span><span id="genre" itemprop="genre">TechArticle</span><span id="description" itemprop="description">I am looking at ajax recently. It needs to be a relatively basic thing. Newbies can take a look! DOCTYPE HTML PUBLIC -//W3C //DTD HTML 4.0 Transitional//EN HTML HEAD TITLE New Document /TITLE META NAME=Genera...</span> </div> <div class="art_confoot"></div>