Home > Backend Development > PHP Tutorial > [Original] Ajax implementation of user registration function tutorial 2_PHP tutorial

[Original] Ajax implementation of user registration function tutorial 2_PHP tutorial

WBOY
Release: 2016-07-13 17:11:37
Original
741 people have browsed it

[Original] Ajax implementation of user registration function tutorial 2','

//

This tutorial is original from this site, please indicate the source when reprinting

Author: www.drise.cn

Email:drise@163.com

QQ:271728967

//

The first reg.php file above has been completed, I will do the second step

var xmlHttp = false;
function ajaxcreate(){//Here is the creation of xmlhttpt object

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 are the operations to be performed after receiving the reg.php onblur() event,

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="

Verifying, please wait...


}

if(xmlHttp.readyState == 4 ){


document.getElementById("divxm").innerHTML=xmlHttp.responseText;


}


}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629575.htmlTechArticle[Original] Ajax implementation of user registration function tutorial 2',' // This tutorial is original from this site, please reprint it Indicate the source author: www.drise.cn Email: drise@163.com QQ:271728967 // The first reg.php text above...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template