11
Bootstrap 4 How to open external url in modal dialog
<a href="#mymodal" data-remote="my-remote-file.php" data-toggle="modal" data-target="#mymodal">Launch demo modal</a>
<div class="modal" id="mymodal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
my-remote-file.php content
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<script>
$('#mymodal').on('show.bs.modal', function(e) {
var button = $(e.relatedTarget);
var modal = $(this);
modal.find('.modal-body').load(button.data("remote"));
});
</script>
Interserver | Standard & VPS Cloud Hosting | $2.50 /Month
Flexible VPS hosting platform to deploy your online projects.
Economical and balanced between processor cores, memory and storage
rated 29 times
(20)
(9)
comments: 0 / hits: 13051
/ 4 years ago, thu, may 2, 19, 04:15:11
More From
» HTML, XML
Comments
There are no comments for this Snippet yet