I want to validate email, what's wrong in this. Return false is not working
$.validator.addMethod("email_exist", function(value, element, arg){
var x = 0;
$.ajax({
url: '../signup/validateemail.php',
type: 'post',
data: 'email_address='+value,
cache:false,
success: function(response) {
if(response == 0){
x++;
}
}
});
alert(x);
if(x > 0){
return false;
}else{
alert('yeh');
return true;
}
return true;
},'');