Dormilich thank you! That got me closer to the target. I still get an error message:
XHR failed loading: GET "http://localhost/a-brandRoadmapTest/cd_catalog.xml".
But that might be due to other js factor. Will work on this some more & see if I can fix it. At least now it understands something is supposed to come into that page.
Thx
D
Actually am not sure. But i would say that I am using the protocol? I am just learning xml. following a tutorial where the instructors places the xml in the same page. I went to www3 & found some added info.
Trying out the example from their page using this code in the calling file.
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
myFunction(xhttp);
}
}
xhttp.open("GET", "http://localhost/a-brandRoadmapTest/xml/cd_catalog.xml", true);
xhttp.send();
}
function myFunction(xml) {
var i;
var xmlDoc = xml.responseXML;
var table="<tr><th>Artist</th><th>Title</th></tr>";
var x = xmlDoc.getElementsByTagName("CD");
for (i = 0; i <x.length; i++) {
table += "<tr><td>" +
x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue +
"</td><td>" +
x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue +
"</td></tr>";
}
document.getElementById("demo").innerHTML = table;
}
</script>
I tried both in the head section of the html file & at the bottom
XMLHttpRequest cannot load http://localhost/a-brandRoadmapTest/xml/cd_catalog.xml. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 403.
firstTry2.html:22 XHR failed loading: GET "http://localhost/a-brandRoadmapTest/xml/cd_catalog.xml".