Create XMLHttpRequest
functioncreatexmlhttp () {varXmlHttp =NULL; //according to window. Whether the XMLHttpRequest object exists using different creation methods if(window. XMLHttpRequest) {xmlHttp=NewXMLHttpRequest ();//how browsers like FireFox and opera support are created}Else{xmlHttp=NewActiveXObject ("Microsoft.XMLHTTP");//How Internet Explorer support is created } returnxmlHttp; }
functiongetsequence () {varTel2=document.getelementbyid ("Mobilemessagenumber"). Value;if(tel2==NULL|| tel2== "") {alert ("Please enter your mobile phone number!"); return;}varUrl= "/////"; varXmlHttp =createxmlhttp (); //Create a XMLHttpRequest objectXmlhttp.onreadystatechange =function () { if(Xmlhttp.readystate = = 4) { //call the Showinfo method to display the server feedback information varm =Xmlhttp.responsetext; if(M.indexof ("Success") >0) {alert ("SMS has been sent successfully, 3 minutes did not receive the text message can be clicked again!" "); document.getElementById ("Sequence"). Value=m.substr (M.indexof ("=") +1); } if(M.indexof ("frequent") >0) {alert ("You just sent a text message, please later"); } if(M.indexof ("failed") >0) {alert ("System error, try again later"); } } }; Xmlhttp.open ("POST", URL,true); Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded"); Xmlhttp.send ("Tel=" + encodeURIComponent (Tel2));//send a request body containing user input information}
Compatible version Implementation XMLHttpRequest