The jQuery.validate plugin will take care of this, and I highly recommend you use it:
$('#submitme').validate({ rules: { n1: { remote: { url: 'validate.php', type: 'post' } } } });
But if you do not want to use it, another possibility is to use a global variable, for example:
$('#submitme').submit(function() { if (!$.formSubmitting) { var $form = $(this); $.post('validate.php', { value: $('#n1').val() }, function (data) { if (data == 'true') {
Just a note: the button that you placed inside the form is not a submit button, so clicking on it will not trigger the submit handler. You must do this with the submit button:
<input value="Send" type="submit" />
Darin Dimitrov
source share