Simon911 Simon911 - 1 month ago 15
Ajax Question

Close Bootstrap's modal with AJAX

I use the modal of Twitter's Bootstrap.
You can close the modal, by clicking on a button or something different with the tag

data-dismiss="modal"
.
I would like to process my form in the modal with AJAX (by clicking on a submit button) and then close the modal.
So how do close this modal in AJAX?
Or is that not possible?

(sorry for my bad English...)

Answer

If you read further down the documentation:

$('#myModal').modal('hide')

Just get the ID of the modal, and replace myModal with it. Then place it in the AJAX success handler and there you have it.