I have a GetValues function in JavaScript that the patameter result
receives an HTML string this I would like to display and open a modal I was trying to do this with Iframe but if there is another easier way it is welcome.
thanks in advance
<div id="myModal" class="modal fade" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">HTML Viewer</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<iframe src="data:text/html;charset=utf-8,' + encodeURIComponent(result),"></iframe>
</div>
</div>
</div>
</div>
function GetValues(result) {
var modal = document.getElementById("myModal");
// Open the modal over everything
modal.modal("show", { keyboard: false, backdrop: 'static' });
// Add the HTML to the modal
$("#myModal .modal-body").html(
$('<iframe>', {
src: 'data:text/html;charset=utf-8,' + encodeURIComponent(result),
}));
}