Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
104
rated 0 times [  108] [ 4]  / answers: 1 / hits: 70501  / 8 Years ago, thu, march 3, 2016, 12:00:00

I have a button which opens a modal but I have prevented the modal close by clicking background or ESC key.



My button looks like this:



<button data-toggle=modal data-target=#CompanyProfiledata-backdrop=static data-keyboard=false>Click </button>


How do I close this modal after $.ajax success using jQuery?



I have done a few tests - the modal has closed but the background gets locked, and I cannot do anything until I refresh the page


More From » jquery

 Answers
5

To close bootstrap modal you can pass 'hide' as option to modal method as follows.



$('#CompanyProfile').modal('hide');


Use this code inside ajax success.



Fiddle Demo


[#63065] Tuesday, March 1, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
byronkodyo

Total Points: 552
Total Questions: 87
Total Answers: 104

Location: Burundi
Member since Sat, Aug 21, 2021
3 Years ago
;