I have a series of endpoints that a vendor's application has open for me to get files from. If I enter these endpoints into the address bar of a browser, the file opens up, but if I try to GET them via jQuery AJAX, it fails with a cross-origin error (No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mydomain' is therefore not allowed access.). The vendor application REST Web service does not support CORS. Here is my AJAX call:
$.ajax({
url: "http://vendorrestwebservice/endpoint",
type: "GET",
success: function (result) {
console.log("downloaded file");
},
error: function (error) {
console.log("Failed to download file!");
}
});
Why does the file open when pasted into an address bar, but not when called via my GET request?