Access-Control-Allow-Headers


#1

Hi I am trying to call a Webservice using AJAX / Jquery, this is my code:

var settings = {
“async”: true,
“crossDomain”: true,
“url”: “http://flightxml.flightaware.com/json/FlightXML2/Arrived?airport=MRLB”,
“method”: “GET”,
“headers”: {
“authorization”: “authorization my user and apikey here”,
“cache-control”: “no-cache”,
}
}

$.ajax(settings).done(function (response) {
console.log(response);
});

However I am getting this error:

Request header field cache-control is not allowed by Access-Control-Allow-Headers in preflight response.

Any ideas how to fix this? I am pretty sure this is a CORS issue.

thanks,
Danilo


#2

Although we provide an example for it, we do not recommend usage of FlightXML through AJAX due to the numerous potential security issues associated with this method.