jquery - Why is the form not getting submitted? -


<link rel="stylesheet" href="//code.jquery.com/mobile/1.4.2/jquery.mobile1.4.2.min.css"> <script src="//code.jquery.com/jquery-1.10.2.min.js"></script> <script src="//code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>   <script>     $( "#submit" ).click(function() {        $( "#my_form" ).submit();     }); </script>  <body> <form id="my_form" action="my_place.jsp" method="post" style="align:center">     <div data-role="page" id="page1">         <div data-role="header">             <h1>parameters:</h1>         </div>         <div data-role="rangeslider">             <label for="range-1a">support:</label> <input name="range-1a"                 id="range-1a" min="1" max="21" value="1" type="range"> <label                 for="range-1b">support:</label> <input name="range-1b" id="range-1b"                 min="1" max="21" value="5" type="range">         </div>         <div data-role="rangeslider">             <label for="range-2a">confidence:</label> <input name="range-2a"                 id="range-2a" min="50" max="100" value="90" type="range"> <label                 for="range-2b">confidence:</label> <input name="range-2b"                 id="range-2b" min="50" max="100" value="100" type="range">         </div>         <div data-role="fieldcontain">             <label for="select-choice-1" class="select">building:</label>             <select name="select-choice-1" id="select-choice-1">                 <option value="library">library</option>                 <option value="hospital">hospital</option>             </select>         </div>         <input type="submit" name="submit" value="submit" id="submit">     </div> </form> </body> 

i using jquery mobile slider , want submit form my_place.jsp once user clicks on submit. problem in code?

two things

first: wrap click , submit functions function in closure.

$(function() {     //your submit , click functions in here }); 

the reason why need them in closure because listener click , submit not getting instantiated before page loads.. why needs in function that....

second: issue may having.. (i know because had issue this) may need turn ajax off on form.. jquery mobile has issues ajax preventing form working unless turned off.

<form data-ajax="false" id="my_form" action="my_place.jsp" method="post" style="align:center"> 

let know if don't work! luck!


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -