Cannot set property 'innerHTML' of null

1 posts, 0 answers
  1. Zubair
    Zubair avatar
    1 posts
    Member since:
    Sep 2015

    Posted 10 Sep 2015 Link to this post

            <head>
            <script>
                
                    var xhr = new XMLHttpRequest();
                    xhr.onreadystatechange = function () {
                        if (xhr.readyState === 4) {
                            document.getElementById("para").innerHTML =xhr.responseText;
        
                        }
                    };
                    xhr.open('GET', 'Intro.html', true);
                    xhr.send();
                
            </script>
        </head>
        <body >
            <div id="Para"></div>
        
        </body>


    I get this Error

    **Uncaught TypeError:** Cannot set property 'innerHTML' of nullxhr.onreadystatechange @ index.html:11
Back to Top