Using: Bootstrap 4.1.3
Here is one solution but this is not exactly what i am looking for: Bootstrap Modal Dynamic Content
I am getting the content (the entire modal html) from an external file and then i need to show it as a modal.
How to display data
in the modal
$.get("test.html", function(data) {
???
});
I am trying to avoid this alternate approach, where i can append a div to body, put data
in it and then do modal.
$.get("test.html", function(data) {
//$('<div />', { id: 'holdy' }).appendTo('body');
var $holdyDiv = $('<div />').appendTo('body');
$holdyDiv.attr('id', 'holdy');
//append data
$holdyDiv.innerHtml(data);
//do modal
$('#divInData').modal('show');
});
Forgot to mention, this call is happening once the page has finished loading.