cjsaylor
10/17/2012 - 11:36 AM

Bootstrap Modal with Remote Source

Bootstrap Modal with Remote Source

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
.modal-header
  button.close(data-dismiss="modal") ×
  h3 #{modal.title}
.modal-body
  != body
$(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();
  });
});