var UIModals = function () { var initModals = function () { $.fn.modalmanager.defaults.resize = true; $.fn.modalmanager.defaults.spinner = '
  Loading...
'; var $modal = $('#ajax-modal'); $('#modal_ajax_demo_btn').on('click', function(){ // create the backdrop and wait for next modal to be triggered $('body').modalmanager('loading'); setTimeout(function(){ $modal.load('ui_modals_ajax_sample.html', '', function(){ $modal.modal(); }); }, 1000); }); $modal.on('click', '.update', function(){ $modal.modal('loading'); setTimeout(function(){ $modal .modal('loading') .find('.modal-body') .prepend('
' + 'Updated!' + '
'); }, 1000); }); } return { //main function to initiate the module init: function () { initModals(); } }; }();