'While I link an xml file to my html file to show a paragraph on my website it is showing undefined .I'm giving the javascript code i have written

Here I'm providing the javascript code which I have written for this pourpose.

          if(window.XMLHttpRequest){
            xmlhttp = new XMLHttpRequest();
          }
          else{
        
            xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
          }
          xmlhttp.open("GET", "Q4.xml", false);
          xmlhttp.send();
          xmlDoc = xmlhttp.responseXML;
          document.getElementById("m").innerHTML= xmlDoc.getElementsByTagName("p")[0].childNodes[0].nodevalue;
        </script>```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source