submit form using ajaxform on checkbox click

2019-09-07 07:51发布

问题:

I'm trying achieve what it says in the title.

I'm using jQuery and I have the ajaxForm plugin that is used elsewhere in my App.

The code I have currently is

$('form.date-response input[type=checkbox]').live('click', function(){
    $(this).parent('form').submit();
});

But all it seems to do is submit the form, which works, and does the job but it goes to the action to post it. Unlike other forms, it's not using the ajaxForm() request.

Plugin in discussion is http://jquery.malsup.com/form/#ajaxForm

回答1:

It appears to be very late, I've managed to resolve this quickly if anyone else has similar issues..

$('form.date-response input[type=checkbox]').live('click', function(){
    $(this).parent('form').ajaxForm().submit();
});

Hopefully this is good, and correctly. Please share if anyone has any other solutions.