I'm driving crazy with all this same-origin-policy thing.
When I try to do a request to the Google Maps API I have no problems:
var jsonData = $.ajax({
url:"http://maps.googleapis.com/maps/api/geocode/json?address=",
dataType:"json",
async:true,
success: function(json){...}
}
I think that is because Google Maps API allow Access-Control-Allow-Origin. But when I try to use the openls.geog.uni-heidelberg.de API I get the cross-origin error:
var xmlData = $.ajax({
type: "GET",
url:"http://openls.geog.uni-heidelberg.de/route?"
//dataType:"jsonp xml",
dataType: "xml",
async:true,
crossDomain : true,
success: function(xml){...}
}
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
One think I dont understand is if the openls API doesn't allow cross-origin why can do a request directly from my browser just typing the url like:
But I can not do it using jquery. I have also tried the jsonp solution but it's not working with xml.
Some idea of what is going on?