UPDATED I\'m using jQuery validate plugin and remote method to check email availiability with ajax, but I don\'t understand why ajax calls only once. When e
the reason why ajax fires only once is that you have overwritten the success callback of jQuery validate's remote method. Keep it simple and try something like this:
<input name="email_address"/>
with script
<script>
$(function () {
$('form').validate({
rules: {
email_address: {
required:true,
remote: {
url: "your_script.php"
}
}
},
debug: true,
submitHandler: function () { alert('ok'); }
});
});
</script>
and php like
<?php
echo $_GET['email_address'] == "bob";
?>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.checkout-form').validate({
rules: {
on0 : {
required : true,
remote : {
url: YOUR_HOST,
type: "post",
data: {
email_address: function()
{
return $("#email_address").val();
}
}
}
},
},
messages : {
required:"message",
remote: "message"
}
});
});
</script>
in html
<input type="text" name="on0" value="Your e-mail" class="form-field no-mr check-email" id="email_address"/>
And in php code
<?php
echo $_POST['email_address'];
?>