用PHP技术做一个检测用户名是否存在的按钮,能不能不跳转到后台页面直接在本页面和数据库连接进行判断??

来源:百度知道 编辑:UC知道 时间:2024/05/26 06:10:06
我的意思是不通过本页面定义的action路径,只在前台验证,请问谁有思路啊,介绍下就行,着急啊谢谢

AJAX技术,和PHP没关系.

用ajax就行。上面 addgrrr就说得很正确。 实在不明白,就找我

用ajax,不刷新当前页面进行检测.
(1)script.js
var xmlHttp = false;

function CrXMLHttpRequest() {
xmlHttpObj = ["Microsoft.xmlHttp","MSXML2.xmlHttp.5.0","MSXML2.xmlHttp.4.0","MSXML2.xmlHttp.3.0","MSXML2.xmlHttp"];
if(window.XMLHttpRequest) { //Mozilla 浏览器
xmlHttp = new XMLHttpRequest();
} else if(window.ActiveXObject) {
for(i=0;i<xmlHttpObj.length;i++) {
xmlHttp = new ActiveXObject(xmlHttpObj[i]);
if(xmlHttp) {
break;
}
}
} else {
return false;
}
return xmlHttp?xmlHttp:false;
}

function sendAttruValue(value) {
var url = "checked.php?userSTR=" + value;
CrXMLHttpRequest();
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = ReadyAttru;
xmlHttp.send(null);
}
function ReadyAttru() {
if (