Skip to content

Instantly share code, notes, and snippets.

@cjsaylor
Created October 17, 2012 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cjsaylor/3905067 to your computer and use it in GitHub Desktop.
Save cjsaylor/3905067 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