I would like to fetch data from an XML file to a JS variable (I would like to use pure JS, no jQuery). But I have always get error while downloading the file:
var url = "http://www.w3schools.com/xml/note.xml";
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange = function(event){ processRequest(event,xmlhttp); };
xmlhttp.send();
function processRequest(event,xmlhttp) {
if(xmlhttp.readyState != 4) return;
alert("status: " +xmlhttp.status);
}
The response xml is always empty - the response status is 0.