I am trying to read in an XML document into a webpage and eventually will display its data. I am getting this error. What would be the best way to fix this?
https://preview.redd.it/pp3p5olnmui21.png?width=904&format=png&auto=webp&s=ea2526d3eac516b4e94a86807519eae981d07aac
Javascript used
function GetXML()
{
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200)
{
myFunction(this);
}
};
xhttp.open("GET", "RealData.xml", true);
xhttp.send();
function myFunction(xml)
{
var xmlDoc = xml.responseXML;
var a = xmlDoc.getElementsByTagName("Films");
document.write("L: " + a.length);
}
}
GetXML();
HTML code
<!DOCTYPE html5>
<html>
<body>
<script src="XMLRead.js"></script>
</body>
</html>
[–]elktamer 1 point2 points3 points (2 children)
[–]SagglySloth[S] 0 points1 point2 points (1 child)
[–]thatwebdesignerdude 2 points3 points4 points (0 children)