This is a migrated thread and some comments may be shown as answers.

Cannot set property 'innerHTML' of null

0 Answers 22 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Zubair
Top achievements
Rank 1
Zubair asked on 10 Sep 2015, 04:58 PM
        <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

No answers yet. Maybe you can help?

Tags
Ajax
Asked by
Zubair
Top achievements
Rank 1
Share this question
or