Tomas GF schrieb:
I'm using jQuery with form and validate plugins. I have several forms on the
same page. The following code submit the proper form:
$(document).ready(function() {
var loader = jQuery('<div id="loader">loader</div>');
$.validator.setDefaults({
debug: true,
focusInvalidElement: true,
submitHandler: function(form) {
$(form).ajaxStart(function() {
$(this).prepend(loader);
});
$(form).ajaxForm();
var options = { target: $(form).parent(), clearForm: true, resetForm:
true }
$(form).ajaxSubmit(options);
}
});
$("form").each(function(i){
$(this).validate();
});
});
The problem is that IE submits the form TWICE! All other browsers I've
tested, submit the form only once...
ajaxForm binds a submit handler (submitting the form via ajax on
submit), while ajaxSubmit directly submits via ajax. Mixing both is
wrong. It looks like you want to use only ajaxSubmit.
Jörn