Javascript/jQuery multiple form submits on the same page

As far as I’m aware javascript can only perform a form submition per page.

As a workaround you can set different target’s per form and then submit the forms (via jQuery’s submit() for instance).

Example:

1
2
3
4
5
6
7
8
9
10
11
<script>
$(function() {  
  $("#form1").submit();
  $("#form2").submit();
});
</script>
<iframe name="target1" width="320" height="240"></iframe>
<iframe name="target2" width="320" height="240"></iframe>

<form id="form1" action="http://url.to.post.to" method="post" target="target1"></form>
<form id="form2" action="http://second.url.to.post.to" method="post" target="target2"></form>

That should do the trick.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>