2

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>
    
    
2

1 Answer 1

0
 if (this.readyState == 4 && this.status == 200) {
            document.getElementById("responseModal").innerHTML =
            this.responseText;
       }

You problems is THIS this.responseText

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.