madsovenielsen Posted July 2, 2010 Report Share Posted July 2, 2010 (edited) Hey all.I have taken this JavaScript directly from w3schools.com <html><body><script type="text/javascript">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","cd_catalog.xml",false);xmlhttp.send();xmlDoc=xmlhttp.responseXML; document.write("<table border='1'>");var x=xmlDoc.getElementsByTagName("CD");for (i=0;i<x.length;i++) { document.write("<tr><td>"); document.write(x[i].getElementsByTagName("ARTIST")[0].childNodes[0].nodeValue); document.write("</td><td>"); document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue); document.write("</td></tr>"); }document.write("</table>");</script></body></html> I have the correct xml file stored localy on my computer. in the same place as my html page with the scriptbut im getting access denied on line 13. i have read that this shouldt only happen if the xml file and the script is in 2 different domains. Whats wrong ?/mads Edited July 2, 2010 by madsovenielsen Link to comment Share on other sites More sharing options...
madsovenielsen Posted July 2, 2010 Author Report Share Posted July 2, 2010 (edited) Nevermind. the files have to reside on a web server. and be served over HTTP.my big mistake Edited July 2, 2010 by madsovenielsen Link to comment Share on other sites More sharing options...
LaRK Posted April 28, 2011 Report Share Posted April 28, 2011 Nevermind. the files have to reside on a web server. and be served over HTTP.my big mistake Thank you, mads, for sharing your experience. I did essentially the exact same experiment, and I don't know how long it would have taken me to figure out that it had to be served over HTTP. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now