javascript - Submiting one form to two different URLs -


hello, folks!!

i not experience. appreciate follows:

goal: run 2 actions associated 1 submit, have add urls , pull out necessary info need form.

constraints: no access database, no ajax , no php.

problem: nothing happens when use <input type="button" value="submit" onclick="onbtn1(); onbtn2();">

i tried these no luck:

  1. two onclick actions 1 button
  2. submit single form 2 actions

html code:

<script type="text/javascript">     function posttourl () {         document.form1.action = "https://db2.com/cgi-bin/b.cgi?"         document.form1.submit();     }     </script>     <form id=" form1" method="post" action="https://db1.com/cgi-bin/a.cgi?" onsubmit="posttourl();">         <input type="text" id="field1" name="field1">         <input type="text" id="field2" name="field2">         <input type="button" value="submit" name="sdb">     </form> 

can please me? thank you!

the best solution use ajax, send form twice on submit event.

maybe can try add hidden form mirrored values different action url. way, when submit form submit hidden 1 too.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -