Skip to content

Instantly share code, notes, and snippets.

@m-basov
Last active August 29, 2015 14:06
Show Gist options
  • Save m-basov/1a60ded64daa5da8529c to your computer and use it in GitHub Desktop.
Save m-basov/1a60ded64daa5da8529c to your computer and use it in GitHub Desktop.
Bootstrap modal Ajax load
$('[data-toggle="modalWindow"]').on('click',
function(e) {
$('#modalWindow').remove();
e.preventDefault();
var $this = $(this)
, $remote = $this.data('remote') || $this.attr('href')
, $modal = $('<div class="modal" id="modalWindow"><div class="modal-body"></div></div>');
$('body').append($modal);
$modal.modal({backdrop: 'static', keyboard: false});
$modal.load($remote);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment