Quick question. How do I call a Bootstrap Modal from PHP? I have a form and when some error happen I want to show an alert modal to the user. I've tried many solutions from other topics but neither has worked.
Here's what I've tried last:
echo '<script type="text/javascript">';
echo '$(\'#alertDuplicate\').modal(\'show\')';
echo '</script>';
and here's the modal:
<!-- Modal Alert Duplicate -->
<div class="modal fade" id="alertDuplicate">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Erro</h4>
</div>
<div class="modal-body">
<p>Essa função já existe!</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->