我有以下代码,按下某个按钮后,应该验证电子邮件地址(此功能已经可以使用),然后应该尝试发布我的表单,如果它返回“错误”,它应该显示一个错误。我想我在某个地方混淆了 PHP 和 JS。
$('#recoverSub').live('click',function() {
$("#recoverPost").validate({
rules: {
recoverField: {
email: true
}
},
messages:{
recoverField: {
email: "Not a valid email."
}
}
});
if($("#recoverPost").valid())
{
$.post('php/recoverPost.php', $('#recoverPost').serialize(), function(){
function(data) {
if(data != "Error")
{
$('#recoverPost').hide();
$('#success').show();
}
else
{
echo "This email is not in our records.";
}
}
});
}
});
最佳答案
else
{
echo "This email is not in our records.";
}
您可能想使用 alert
而不是 echo
:
alert("This email is not in our records.");
关于php - 找不到此 jQuery 代码中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5445066/