DrTrans Posted April 30, 2013 Share Posted April 30, 2013 Backstory. Im using Bootstrap Modal's , and i have a modal that opens up a file called test.php <script type="text/javascript"> $("a[data-toggle=modal]").click(function(data1) { var a_id = $(this).attr('id'); $('#appcontent').show().html('<p><img src=\"../images/loader.gif\" width=\"19\" height=\"19\" /></p>'); if(a_id >= 0) { $.ajax({ cache: false, type: 'POST', url: 'ajaxc/test.php', data: 'id='+a_id, success: function(data1) { $('#runtest').show(); $('#appcontent').hide(); $('#appcontent').show().html(data1); } }); }; }); </script> inside test.php i have a form <?php $submit = $_POST['submit']; if($submit) { print " I should be in the same modal box"; } ?> <form action = "test.php" method="post"> <input name="blah"> </form> When i submit this form it completely reloads the page all together.... and is not keeping it within the original modal box. How do i go about making the form submit within the modal box and basically i should see " i should be in the same modal box " without the box closing. Quote Link to comment https://forums.phpfreaks.com/topic/277465-php-or-jquery/ Share on other sites More sharing options...
Solution akphidelt2007 Posted April 30, 2013 Solution Share Posted April 30, 2013 To keep a modal open you would have to prevent the default form submit behavior and submit the form via another ajax call and handle the submittal yourself. Quote Link to comment https://forums.phpfreaks.com/topic/277465-php-or-jquery/#findComment-1427352 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.