Basicly, i've used
<script>
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", "db.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
document.write("<table border='1'>");
var x = xmlDoc.getElementsByTagName("item");
for (i = 0; i < x.length; i++)
{
document.write("<tr><td>");
document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("desc")[0].childNodes[0].nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
</script>
From w3school, to do something in my mind that is simple, and should work. But im suspecting that it needs to be on a server for it to work, either that or i can't use it properly. For the XML i've got several
<item>
<title>example</title>
<desc>description</desc>
<tags>Drama, Fantasy, Romance</tags>
<date>01 08 1982</date>
<img>img/nna.jpg</img>
<a_link>Link</a_link>
</item>
Basicly, my question is. Does this work on my own computer, i'm suspecting that it won't let me due to some security setting and that i need to use json. Please enlighten me.