发送ajax没反映,没报错什么反映也没有,经常遇到这种情况。
用户注册界面使用ajax,处理ajax请求的是另一个php.
下面是注册界面的javascript部分:
<script type="text/javascript">
function checkname(name)
{
var value=document.getElementById(name).value;
var error_tip=name+"_error_tip";
if(value=="")
{
document.getElementById(error_tip).innerHTML="Name cannot be empty";
document.getElementById(error_tip).style.visibility="visible";
return false;
}
else
{
var patt1=new RegExp("[0-9]");
var patt2=new RegExp("[^A-z]");
var r1=patt1.test(value);
if(r1)
{
document.getElementById(error_tip).innerHTML="Name can not contain digital";
document.getElementById(error_tip).style.visibility="visible";
return false;
}
var r2=patt2.test(value);
if(r2)
{
document.getElementById(error_tip).innerHTML="The name can not contain numbers or punctuation marks";
document.getElementById(error_tip).style.visibility="visible";
return false;
}
}
document.getElementById(error_tip).style.visibility="hidden";
return true;
}
function checkemail(name)
{
var validchar="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-@.";
var value=document.getElementById(name).value;
var error_tip=name+"_error_tip";
var flag1=0;
var flag2=0;
if(value=="")
{
document.getElementById(error_tip).innerHTML="Email cannot be empty";
document.getElementById(error_tip).style.visibility="visible";
return false;
}
else
{
for(var i=0;i<value.length;i++)
{
if(validchar.search(value[i])==-1)
{
document.getElementById(error_tip).innerHTML="Please enter a valid email";
document.getElementById(error_tip).style.visibility="visible";
return false;
}
if(value[i]=="@")
{flag1++;}
if(value[i]==".")
{flag2++;}
}
if((flag1!=1)||(flag2!=1))
{
document.getElementById(error_tip).innerHTML="Please enter a valid email";
document.getElementById(error_tip).style.visibility="visible";
return false;
}
document.getElementById(error_tip).style.visibility="hidden";
return true;
}
}
function checkpw(name)
{
var value=document.getElementById(name).value;
var error_tip=name+"_error_tip";
if(value=="")