I have trouble loading an xml file stored on my local network… (you could say… local HDD… it doesn’t matter I guess).
I have the piece of code that you find everywhere online:
$.ajax({
url: "data\raportfile.xml",
dataType: ($.browser.msie) ? "text" : "xml",
error: function(data){
alert('ma-sa de treaba');
},
success: function(data){
var xml;
if (typeof data == "string") {
xml = new ActiveXObject("Microsoft.XMLDOM");
xml.async = false;
xml.loadXML(data);
} else {
xml = data;
}
// Returned data available in object "xml"
}
});
But I don’t know why… I get the error message… that this stuff doesn’t work…
Are there any ways besides this one? Is there something I do wrong here? Thanks a lot!
The path
data\raportfile.xmllooks like a filesystem path. Your file needs to be accessible over http.Put the file somewhere in the site root, and address it using forward slashes ie
/path/to/file.xml