I have some modal in index.php and want to load content into my modal with ajax request to ajax.php.
when i try to load the content with ajax.php
the response inner ajax.php
has load normaly but my .js
in index.php
not load for example my datepicker is not loaded inside modals
Call Function :
AJAX Request :
<script>
function addProduct(str) {
if (str=="") {
document.getElementById("responseModal").innerHTML="";
return;
}
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
document.getElementById("responseModal").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","SERVER/ajax.php?id="+str,true);
xmlhttp.send();
}
</script>
My Modal:
<div class="xx-modal" id="open-modal">
<div class="xx-modal-dialog">
<button class="xx-modal-close uk-close" type="button"></button>
<div id="responseModal">Waiting For AJAX to Load!</div>
</div>
</div>
And This My JavaScript Src that i want to included inside my modal
<script src="example.com/static/assets/js/xxxx.js"></script>
<script src="example.com/static/assets/js/xxxx.js"></script>
<script src="example.com/static/assets/js/xxxx.js"></script>