[Answer]-Running submit() twice to submit to different forms at once

1👍

✅

For this particular instance, you can send it together like:

$('#save').on('click', function(event){
     event.preventDefault();
     var form = $('<form method="post"></form>'); 
     $(form).append($('#field1'));
     $(form).append($('#field2'));

     $(form).appendTo('body');

     $(form).submit();

});

0👍

If both forms have the same action, can’t you wrap all fields within one <form> tag?

This way, you submit fields from both forms at the same time, without the need of JS as proposed in another answer.

Leave a comment