Close Bootstrap modal with AJAX

I am using modal Twitter Bootstrap. You can close the modal by clicking on the button or something else with the data-dismiss="modal" tag. I would like to process my form in modal format using AJAX (by clicking the submit button), and then close the modal. So how to close this modal in AJAX? Or is it impossible?

(sorry for my bad english ...)

+7
ajax twitter-bootstrap
source share
2 answers

If you read the documentation further:

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

Just enter the modality identifier and replace it with myModal . Then put it in the AJAX success handler and there you have it.

+16
source share

You can use this script to close modal

 <button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true"> <i class = "icons-office-52"></i> </button> $("#close_btn").trigger("click"); 

or

 $('#my_model').modal('hide'); 
+3
source share

All Articles