[EMAIL PROTECTED] schrieb:
While I love jQuery, I haven't used it for anything particularly
complicated - I'm having a difficult time getting an ajax submitted
form in to work with the form plugin and the validation plugin.
I'm trying to use the validation plugin's submit handler method:
submitHandler: function(form) {
$(form).ajaxSubmit();
}
to also include the form plugin's options object that looks something
like:
var options = {
success: function() {
self.parent.tb_show('Email My Visit','#TB_inline?
height=180&width=407&inlineId=tbSuccess','');},
error: function() {
self.parent.tb_show('Email My Visit','#TB_inline?
height=180&width=407&inlineId=tbFailure','');
}
};
, but I have no idea as to how to go about doing that.
submitHandler: function(form) {
$(form).ajaxSubmit(options);
}
seemed like the obvious solution, but that didn't work. Help would be
much appreciated, been really banging my head against the wall on
this. The form validation works, but when I submit it, the success/
error functions aren't triggering. They did work when called by $
('#ajaxForm').ajaxForm(options);
The demo contains in example for passing options to ajaxSubmit:
http://jquery.bassistance.de/validate/demo-test/ajaxSubmit-intergration-demo.html
The interesting lines are these:
var v = jQuery("#form").validate({
submitHandler: function(form) {
jQuery(form).ajaxSubmit({
dataType: "json",
after: function(result) {
if(result.status) {
v.showErrors(result.data);
v.focusInvalid();
}
}
});
}
});
Looks like you are missing something small, because your code looks
right, as Mike already noticed.
--
Jörn Zaefferer
http://bassistance.de