I am trying to import data from an XML file. The code I am using is saved as an HTML file in the same directory as the XML file. However, the code fails to read the xml file. I am not certain I have defined the path to the file correctly. My code is as follows;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>XML Data Download</title>
</head>
<body>
<script>
alert("Help");
    if (window.XMLHttpRequest) {
        // code for modern browsers
        xmlhttp = new XMLHttpRequest();
     } else {
        // code for old IE browsers
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    xhttp.open("GET", "Players.xml", false);
    alert("help2");
    xhttp.send();
    var xmlDoc = xmlhttp.responseXML;
    document.write("<table border='1'>");
    var x = xmlDoc.getElementsByTagName("Player");
    for (i - 0; i< x.length; i++) {
        alert(x.length);
        document.write("<tr><td>");
        document.write(x[i].getElementsByTagName("Name")[0].childNodes[0].nodeValue);
        document.write("</td><td>");
        document.write(x[i].getElementsByTagName("TeleNo")[0].childNodes[0].nodeValue);
        document.write("</td></tr>");
    }
    document.write("</table>");
</script>
</body>
</html>
I have used 2 alert messages to show where the code fails. The first alert message works but the second [alert("help2");] message does not show. This is following [ xhttp.open("GET", "Players.xml", false);] Ant ideas why the file is not being read? The XML file work okay in a VB.Net application I have written.
