Skip to content

Instantly share code, notes, and snippets.

@Teino1978-Corp
Created November 22, 2015 18:30
Show Gist options
  • Save Teino1978-Corp/fcd1c3585ef5fe8cd2d5 to your computer and use it in GitHub Desktop.
Save Teino1978-Corp/fcd1c3585ef5fe8cd2d5 to your computer and use it in GitHub Desktop.
Bootstrap Modal with Remote Source
$(document).ready(function() {
$(document).on('.ajaxModal', 'click', function(event) {
$.get($(this).attr('href'), function(response) {
$('<div class="modal hide fade">' + response + '</div>').modal();
});
event.preventDefault();
});
});
.modal-header
button.close(data-dismiss="modal") &times;
h3 #{modal.title}
.modal-body
!= body
render: (req, res, view, data) ->
if not data.layout
data.layout = if req.header('X-Requested-With') is 'XMLHttpRequest' then 'layouts/modal' else 'layouts/default'
res.render view, data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment