php - Submit directly from a modal dialogue jquery -
i have modal dialogue jquery populate div,i need instead of populate div submit directly ,how can achieve that, did: have button when click opens modal dialogue,with modal dialogue add data , save data in div,below code:
my part of code :
<script> $(function() { $( "#mydialog2" ).dialog({ autoopen: false, height: 300, width: 700, modal: true, buttons: { "add": function() { $('#keyword_new_name').val($('#keyword_new_nameadd').val()); $( ).dialog( "close" ); }, "cancel": function() { $( ).dialog( "close" ); } }, close: function() { $('#keyword_new_nameadd').val(""); } }); $( "#newkeyword" ).click(function() { $( "#mydialog2" ).dialog( "open" ); }); }); </script>
html looks that:
<div id='mydialog2' > <table cellpadding='11' > <tr> <td></td> <td>name:</td><td><input type='text' name ='keyword_new_nameadd' id='keyword_new_nameadd' size ='35' /></td> </tr> </table> </div> <form method="post" action=""> <div> <table cellpadding='11' > <tr> <td></td> <td>name:</td><td><input type='text' name ='keyword_new_name' id='keyword_new_name' size ='35' /></td> </tr> </table> </div> <input type='button' value='newkeyword' id='newkeyword' /> <input type='submit' value='addkeyword' id='addkeyword' /> </form>
thank help!!!
if mean want directly submit form, right after (or instead of... not sure need)
$('#keyword_new_name').val($('#keyword_new_nameadd').val());
add
$('form').submit();
personally give <form>
, id , use instead
$('#myformid').submit();
Comments
Post a Comment