In my projects using Bootstrap 3, I created the pleaseWait function, which I call from other functions that make AJAX calls. This function contains the show and hide function. The show function will load what html I want to display (spinner, text, etc.), whereas the hide function will hide the modal. You can add more jquery to achieve a fading effect.
Functions:
pleaseWait: function () { var $pleaseWaitModal = null; return { show: function() { $("#pleaseWaitModal").load( "pleaseWaitModal.html", function() { $pleaseWaitModal = $(this); $pleaseWaitModal.modal({ backdrop: "static", keyboard: false }); }); }, hide: function () {
Call example:
function myAjaxFunction() { pleaseWait().show(); $.ajax({
source share