[Original]ajax implementation of user Registration function tutorial Two

Source: Internet
Author: User

[Original]ajax implementation of user Registration function tutorial two ', '

//

This tutorial by the original site, reproduced please specify the place

Author: www.111cn.net

Email: drise@163.com

qq:271728967

//

The first reg.php file is done and I'm going to do the second step.

var xmlHttp = false;
function Ajaxcreate () {//Here is the creation of XMLHTTPT to like

try {
XmlHttp = new ActiveXObject ("Msxml2.xmlhttp");
catch (e) {

try {
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");
} catch (E2) {

XmlHttp = false;
}

}


if (!xmlhttp && typeof XMLHttpRequest!= \\\ ' undefined\\\ ') {


XmlHttp = new XMLHttpRequest ();


}


if (!xmlhttp) {alert (\\\ ' Create xmlHttp Fail \\\ '); return false;}


}

function Ajax () {//Here is the action to be performed after the reg.php onblur () event is received.

Ajaxcreate ();

var Xmvalue=document.getelementbyid ("XM"). Value;


var url= "/boke/blog/type.php?txt=" +encodeuri (Xmvalue);


if (xmvalue== null | | xmvalue.length>20 | | | xmvalue = "") return false;


Xmlhttp.open ("POST", url,true);


Xmlhttp.setrequestheader ("Content-type", "application/x-www-form-urlencoded");


Xmlhttp.send (Xmvalue);


Xmlhttp.onreadystatechange=returnstate;


}


function Returnstate () {


if (xmlhttp.readystate!= 4) {


document.getElementById ("Divxm"). Innerhtml= "<div id=\\\ ' phperblog_showinfo_red\\\ ' ><font color=red> In the verification, please ...</font></div> later ";


}

if (xmlhttp.readystate = = 4) {


document.getElementById ("Divxm"). Innerhtml=xmlhttp.responsetext;


}


}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.