I think you are looking for this custom feature. It accepts the βdrag and dropβ attribute and dynamically creates the necessary div to host the remote content. Just put data-toggle = "ajaxModal" on any link you want to download via AJAX.
JS Part:
$('[data-toggle="ajaxModal"]').on('click', function(e) { $('#ajaxModal').remove(); e.preventDefault(); var $this = $(this) , $remote = $this.data('remote') || $this.attr('href') , $modal = $('<div class="modal" id="ajaxModal"><div class="modal-body"></div></div>'); $('body').append($modal); $modal.modal({backdrop: 'static', keyboard: false}); $modal.load($remote); } );
Finally, in remote content, you need to include the whole structure.
<div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"></h4> </div> <div class="modal-body"> </div> <div class="modal-footer"> <a href="#" class="btn btn-white" data-dismiss="modal">Close</a> <a href="#" class="btn btn-primary">Button</a> <a href="#" class="btn btn-primary">Another button...</a> </div> </div> </div>
Paul Marti May 01 '14 at 17:50 2014-05-01 17:50
source share