0

Is there any way to submit multiple forms using ajax ?

for eg form id="form1" and form id="form2"

both the forms will be submitted separately as needed.

to be more specific i am using this for my form submission.

thanks

1 Answer 1

3

Sure:

$('#form1, #form2').submit();

after having AJAXified them of course:

$(function() {
    $('#form1, #form2').submit(function() {
        $.ajax({
            url: this.action,
            type: this.method,
            data: $(this).serialize(),
            success: function(result) {
                alert('thanks for submitting');
            }
        });
        return false;
    });
});

UPDATE:

After your update it seem that you are using the jquery form plugin. In this case you could force the AJAX submission by invoking the ajaxSubmit method on the 2 forms like this:

$('#form1, #form2').ajaxSubmit();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.