javascript - How to post mutliple forms from a webpage -


I want to post 2 variations using javscript, but I can not find it. Can anyone help me?

It seems that I have to submit the first form non-ASIC accordingly, but I do not follow their code:

HTML

  & Lt; Form name = "form1" action = "https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method = "POST" target = "me1" & gt; & Lt; Input type = "hidden" name = "OID" value = "00Df00000000001" /> & Lt; / Form & gt; & Lt; Form name = "form2" action = "https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method = "post" & gt; & Lt; Input type = "hidden" name = "OID" value = "00Df00000000001" /> & Lt; / Form & gt; & Lt; Input name = "submit" value = "submit form" onclick = "submitForms ()" type = "button" & gt;  

JS

  function submit form () {document.forms ["form1"]. Submit (); / * Should be Async? * / Document.forms ["form2"]. Submit (); }  

  var str1 = $ ("form1") .serialize () ; Var str2 = $ ("form2") .sialialize (); AjaxReq (url, str1); AjaxReq (url, str2); Function AjaxRec (URL, Data) {var request = $. Ajax ({url: url, type: "post", data: data, datatype: "html"}); Request.done (function (html) {console.log ('SUCCESS')}); Request.fail (function (jqXHR, textstats) {console.log ("AJAX request failed" + Textstats);}); }  

Comments