javascript - submit a form without using a submit button -


i trying submit without using submit button. here have used javascript , once form has submitted user should directed b.php.

html code

   <form id="jsform" action="b.php" method="post" target="_blank">         <input type="hidden" value="test" name="title"/>                              </form> 

java-script code

<script type="text/javascript">      document.getelementbyid('jsform').submit(); </script> 

these 2 code lines run separately not running together. mistakes have done.

in javascript can this:

window.onload=function() {   document.getelementbyid("jsform").submit(); // using id } 

and jquery

$(function() {   $("#jsform").submit(); // using id }); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -