Hi, I need to load xml file from specified url using javascript. Here is what i am doing:
function GetXMLDoc() {
var url = 'http://www.warm.fm/exports/NowOnAir.xml';
var httpRequest = null;
try {
httpRequest = new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e) {
try {
httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (e2) {
try {
httpRequest = new XMLHttpRequest();
}
catch (e3) { httpRequest = false; }
}
}
if (httpRequest) {
httpRequest.open('POST', url, false);
httpRequest.setRequestHeader("Content-Type", "text/xml");
httpRequest.send(null);
alert(httpRequest.responseText);
}
else {
alert(httpRequest);
}
It works perfectly in IE but it does not in FF and Google Chrome. Firebug shows me the following error:
*uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost:49697/XMLParser.js :: GetXMLDoc :: line 43" data: no]*
Is there anyone who has the answer that will help me in solving the issue?
Thanks, Mohin