Chrome can't access local XML using $.ajax()?
I am trying to load a data.xml file using $.ajax(). This works in all browsers except Google Chrome on Mac or PC.It does work in Chrome if ran from my web server, but not locally. This is a project that will be downloaded as a ZIP archive, then ran locally on the clients machine. Is there a trick to getting Chrome to run a local XML? I always get this error:
[object XMLHttpRequest] parsererror TypeError: Cannot read property 'documentElement' of null
Here's my Jquery Code:
$.ajax({
type: "GET",
dataType: ($.browser.msie) ? "text" : "xml",
url: "data.xml",
error: function(XMLHttpRequest, textStatus, errorThrown){
$("#Instructions p").replaceWith('<p>XML Read Error: '+XMLHttpRequest+ ' ' +textStatus+ ' ' +errorThrown+' </p>');
},
success: function(xmldata) {
var xml;
//IE7 Help with XML
if (typeof xmldata == "string") {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(xmldata);
}
else {
xml = xmldata;
}
};