You need to sign in to do that
Don't have an account?
regger118
Using ajax to download xml file from another server
Hi Guys i am trying to download an xml file from a server using the xmlHtttpRequest object but i get an error is not allowed by Access-Control-Allow-Origin.
how can i get around this problem?
Cheers
var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
alert('IE7+, Firefox, Chrome, Opera, Safari');
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
alert('IE6, IE5');
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
alert('xmlhttp.responseText');
}
}
var filePath = "www.somthing.com/file.xml";
xmlhttp.open("GET", filePath, false);
xmlhttp.setRequestHeader("Content-Disposition","inline; filename='"+filePath+"'");
xmlhttp.setRequestHeader("Content-Transfer-Encoding","binary");
xmlhttp.send(null);