i am using the jQuery Validation Plugin using data-validate
For example for email validation i am using the following code
<input type="text" name="email" id="email" value=""
class="input-text validate-email-exist required-entry form-control"
data-validate="required,email"
data-message-required="error message here for required"
data-message-email="error message here for email"
>
I would like to check if email already exist and as far as i know i have to use the remote method, but i dont know how to make it work
I tried to add the rule
$('input.validate-email-exist').rules("add", {
remote : {
url: 'check-email.php',
type : 'post',
success: function(data) {
if (data !== 'true')
{
return true;
}
else
{
return false;
}
}
},
messages: {
remote: "custom remote message"
}
});
but while the ajax call it takes place and return true or false the error message is not displaying at all.
Any help appreciated