I face an issue with bootstrap modal, what I'm trying to do is to insert HTML contents inside bootstrap modal using AJAX but when I load the modal nothing is displayed and when I inspect the modal I can see the html contents from AJAX, I figured out that this because the time that is needed to initialize the modal faster than the time that AJAX takes to load the html contents.
Is there a way to make the modal and the AJAX load at the same time or if there is another way to make html contents from ajax display inside a modal body.
The Modal:
<div class="modal hide fade" id="MobileAppPromoDiv">
<div class="modal-body">
</div>
<div class="modal-footer">
<a href="#" class="btn btn-success" data-dismiss="modal">Ok</a>
</div>
The Ajax:
$.get("URL",{action:21},function(htmlContent){
$('#MobileAppPromoDiv').find('.modal-body').append(htmlContent);
$('#MobileAppPromoDiv').modal('toggle');
});