How to detect the dismissal of a bootstrap modal dialog in javascript?
<p>I am trying to work with the bootstrap modal dialog. The events I am using are <code>hidden</code> and <code>show</code>. I have no problem using the <code>show</code> event. I don't understand how to use the <code>hidden</code> event on the other hand. I am displaying a form in the modal dialog and on the <code>submit</code> event of the form, I am hiding the modal dialog with <code>$('.modal').modal('hide')</code>. This hide event is also fired when the modal is dismissed either by using the close icon, by clicking an abort button which has this markup <code>&lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Abort&lt;/button&gt;</code>, by pressing the escape key or by clicking somewhere on the <code>.modal-backdrop</code>. How can I distinguish a successful form submission from a dismissal of the dialog?</p>