php——ajax验证验证码 验证失败后怎么阻止表单提交呢??
xmlHttp.open("POST",url,true);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyS...
xmlHttp.open("POST",url,true);
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
if(xmlHttp.status == 200)
{
var value = xmlHttp.responseText;
if(value == "no")
{
alert("验证码错误");
//这里验证失败后怎么阻止表单提交呢??
}
}
}
};
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send("code=" + code + "&rand=" + Math.random()); 展开
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
if(xmlHttp.status == 200)
{
var value = xmlHttp.responseText;
if(value == "no")
{
alert("验证码错误");
//这里验证失败后怎么阻止表单提交呢??
}
}
}
};
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send("code=" + code + "&rand=" + Math.random()); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询