I have the following code
jQuery(function() {
jQuery("#newForm").validate({
rules: { },
submitHandler: function(form) {
alert("Submitting")
jQuery("#submitButton").attr('disabled', true)
jQuery("#sendWrapper").append('<span><img src="{{ STATIC_URL }}img/loading.gif"></span>')
jQuery(form).ajaxSubmit({
success: afterFormSubmit,
target: "#ajaxwrapper"
});
}
});
});
I'm finding that the handler is only getting called every first, third, fifth, 7th time the submit button is clicked (the response is pretty much just the form's html with errors etc inserted).
However, changing the function to an onclick handler works everytime.