On my home page I have a log in modal that asks for the users email address and password through a basic form. When the email address is entered I have a remote validation that checks to see if the email address is in my blacklisted table in my DB. But the remote error fires off no matter if the PHP returns false or true and will not let the form submit, even if the PHP returns true. All of the validation works correct except for the remote. I can not seem to fix this problem and I have looked all over and nothing I find can solve this problem.
Home jQuery
$(function(){
$("#frmSignIn").validate({
rules: {
InputEmailAddress: {
required: true,
email: true,
remote:"scripts/blacklist.php"
},
InputPassword: {
required: true,
minlength: 3,
maxlength: 20
}
},
messages: {
InputEmailAddress:{
required:"Don't forget your email address!",
email:"Please enter a valid email address",
remote:"This email address has been backlisted"
},
InputPassword:{
required:"Please enter your password",
minlength:"Password must be longer than 3 characters",
maxlength:"Password can not be longet than 20 characters"
}
},
submitHandler: function(){
var data = $("#frmSignIn").serialize();
$.post('posted.php', data, function(o){
console.log(o);
},'json');
}
});
});
PHP
I will add the actual table check after I get this working
$email = $_GET['InputEmailAddress'];
$valid = true;
echo json_encode($valid);