0

I have a MVC 4 web application and need to submit two forms (maybe three forms) with one button. Is there a way to work around? or I have to merge the forms into one big form?

I searched around, found lots of the threads about "ONE FORM MULTI BUTTONS", but they are not what I am looking for.

Any suggestion, links, ideas are welcomed!

1
  • When you say three forms are you trying to send to multiple sources? For example, you own processor, MailChimp and PayPal? Commented Jul 22, 2013 at 23:22

2 Answers 2

1

You can always submit more forms using Javascript. Intercept the submit event, and use the boilerplate JQuery for Ajax-submitting a form:

$("#theFirstForm, #theSecondForm").on("submit", function(e) {

    // prevent the default form-post
    e.preventDefault();

    $.post($("#theFirstForm").prop('action'), $("#theFirstForm").serialize(), function() {
        // first form post complete 
    });

    $.post($("#theSecondForm").prop('action'), $("#theSecondForm").serialize(), function() {
        // second form post complete 
    });
});
Sign up to request clarification or add additional context in comments.

Comments

0

How about no form and just sending a async post from javascript using XMLHttpRequest?

2 Comments

Thanks this link looks interesting.

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.