javascript - how to pass parameter in action tag? -


I want to pass the res variable as a form action. Is it possible with HTML?

  & lt; Script & gt; Var name = $ ("#name"). Val (); Var file = $ ("# file"). Val (); Var res = localhost: 8080 + "/ test / reg? And name =" + name + "& amp; file =" + file; & Lt; / Script & gt; & Lt; Form action = "res" id = "form" method = "post" enctype = "multipart / form-data" & gt; Name: & lt; Input type = "text" name = "name" id = "name" /> Upload: & lt; Input type = "file" name = "file" id = "file" /> & Lt; / Form & gt; . Document.forms ["form"] submission ();  

Set the action property before submitting it:

 
Var form = document.forms ["form"]; Form.action = res; Form.submit ();

If the user can manually submit this form, then you can use the onsubmit event:

  form .onsubmit = function () {This.action = res; };  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -