I have a javascript function which opens a Bootstrap Modal Dialog:
In the next step I'm loading a HTML snippet from the server, which I want to pass into the showModal()
Function as message. Here is an example snippet loaded from server via ajax and stored in the JS-Variable mySnip
<p>Foo text</p> <script type="text/javascript" > alert("Alert1"); $(document).ready(function(){ alert("Alert2"); }); </script>
After that I open the Modal-Dialog with the loaded with the snippet as parameter:
showModal(mySnip, "Header", true, false);
My problem is, that the Javascript part of the snippet is not loaded. Does anybody know how I can get the Javascript of the snippet executed? (So that the Alerts are shown)
Background:
I'm migrating from Bootstrap 2 to Bootstrap 4. This method worked perfectly fine in Bootstrap 2. I know that this can be achieved in an other way, but I'm migrating a big application with dozens of Modals which are working in this way.