I would like to load the content inside the modal, it works well, but after loading the content the javascript file is not displayed. This is my code:
index.html.twig
,
This is the ajax_backend.js function for loading content:
$(document).on('show.bs.modal', "#myModal", function (e) {
var link = $(e.relatedTarget);
showLoadingDiv();
$(this).load(link.attr("href"), function (responseTxt, statusTxt, xhr) {
if (statusTxt == "success") {
collectionInsideModal();
hideLoadingDiv();
}
if (statusTxt == "error")
alert("Erreur: " + xhr.status + ": " + xhr.statusText);
hideLoadingDiv();
});
$(this).on("hidden.bs.modal", function () {
$(this).html('');
});
});
after loading the contents, the nifty.min.js file is not displayed, so I have to reload this file as follows:
<div>
// content that will be loaded
</div>
<script src="{{ asset('backend/js/nifty.min.js') }}"></script>
How to fix it, so that every time you reload the JS file with the content?
This file nifty.min.js is not specified
source
share