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:
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