This is totally wrong...
submitHandler: function(form) {
$('#submit').click(function() { // <-- causing your double-click situation
....
$.post(....);
});
}
As per the documentation for the submitHandler
callback function,
"Callback for handling the actual submit when the form is valid. Gets the form as the only argument. Replaces the default submit. The right place to submit a form via Ajax after it is validated."
In other words, it only fires when button is clicked on a valid form. The plugin automatically handles the click
, so wrapping the function within another click
handler is pointless and counterproductive.
Just do this...
submitHandler: function(form) {
....
$.post(....);
return false; // not necessary, but it reminds me that the default is blocked
}
You can leave out the return false;
line if you wish. I always put it in (doesn't hurt anything), as it reminds me that the default action
on the form is not going to happen.