<script type= "Text/javascript" >varXhr=false;functioncreatexhr () {varXhobj =false;Try{xhobj=NewActiveXObject ("Msxml2.xmlhttp");//ie msxml3.0+}Catch(e) {Try{xhobj=NewActiveXObject ("Microsoft.XMLHTTP");//ie msxml2.6}Catch(E2) {Xhobj=false;}}if(!xhobj &&typeofXMLHttpRequest! = ' undefined ') {//Firefox, Opera 8.0+, SafariXhobj =NewXMLHttpRequest ();}returnxhobj;}
functionDodel (du,ot,id) {//Create an asynchronous object when performing a deleteXhr=createxhr ();if(Confirm ("Are you sure you want to delete this address?") ")){//sets the parameters for an asynchronous request (type of du--default, whether the default &ot--ordertype account type &aid address number, whether asynchronous is performed)Xhr.open (' Get ', ' dodeladd.ashx? du= ' +du+ ' &ot= ' +ot+ ' &aid= ' +id,true);//Clear Cache (set GET request without caching)Xhr.setrequestheader ("If-modified-since", "0");//Setting the callback functionXhr.onreadystatechange=function(){//Check readiness Status 0--uninitialized, 2--loaded, load complete, 3-interacting, 4--complete interactionif(xhr.readystate==4){//Communication Successif(xhr.status==200){//Get return valuevarres=Xhr.responsetext;//Judgingif(res== "OK"){//gets the ID of the row to deletevarNowtr=document.getelementbyid ("MRDZ1" +ID); Nowtr.parentNode.removeChild (NOWTR);}}} Xhr.send (NULL);}}</script>
Note--js Implementing asynchronous