Reputation: 389
i have a form inside the modal .. after submitting it must show a table inside the modal. how to let the modal opened after that?
here is a piece of the modal.
<div id="AddModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridModalLabel1" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header text-center">
...
</div>
<!---- modal body ---->
<div class="modal-body">
<form method="post" id="form1">
<input type="text" name="searchinput">
<input type="submit" name="btnSearch" value="search">
</form>
<?php
if(isset($_REQUEST['btnSearch']))
{
require_once("connection.php");
$table= getFood($_REQUEST['searchinput']);
echo $table;
}
?>
</div>
i tried javascript like:
$('#form1').on('submit', function(e){
$('#AddModal').modal('show');
e.preventDefault();
});
didnt work.
Upvotes: 0
Views: 274
Reputation: 2407
try adding
echo '<script>$("#AddModal").modal("show'");</script>';
Before
echo $table;
in your php code
Upvotes: 1