Add CORS for engines that support it
(Do we need a fix for IE8/9? - https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest - https://github.com/jaubourg/ajaxHooks/blob/master/src/xdr.js )
This commit is contained in:
parent
a997690897
commit
2f0794738c
3 changed files with 5 additions and 2 deletions
|
@ -248,6 +248,9 @@ OSM.Routing=function(map,name,jqSearch) {
|
||||||
script.src = url+r.name+".gotRoute"+num;
|
script.src = url+r.name+".gotRoute"+num;
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
};
|
};
|
||||||
|
list[num].requestCORS=function(url) {
|
||||||
|
$.ajax({ url: url, method: "GET", data: {}, dataType: 'json', success: r['gotRoute'+num] });
|
||||||
|
};
|
||||||
r['gotRoute'+num]=function(data) {
|
r['gotRoute'+num]=function(data) {
|
||||||
r.awaitingRoute=false;
|
r.awaitingRoute=false;
|
||||||
$(".query_wrapper.routing .spinner").hide();
|
$(".query_wrapper.routing .spinner").hide();
|
||||||
|
|
|
@ -48,7 +48,7 @@ MapQuestEngine.prototype.createConfig = function() {
|
||||||
//url+="&locale=" + I18n.currentLocale(); //Doesn't actually work. MapQuest requires full locale e.g. "de_DE", but I18n only provides language, e.g. "de"
|
//url+="&locale=" + I18n.currentLocale(); //Doesn't actually work. MapQuest requires full locale e.g. "de_DE", but I18n only provides language, e.g. "de"
|
||||||
url+="&manMaps=false";
|
url+="&manMaps=false";
|
||||||
url+="&shapeFormat=raw&generalize=0";
|
url+="&shapeFormat=raw&generalize=0";
|
||||||
this.requestJSONP(url+"&callback=");
|
this.requestCORS(url);
|
||||||
},
|
},
|
||||||
gotRoute: function(router,data) {
|
gotRoute: function(router,data) {
|
||||||
// *** what if no route?
|
// *** what if no route?
|
||||||
|
|
|
@ -24,7 +24,7 @@ OSRMEngine.prototype.createConfig = function() {
|
||||||
if (this._hints[pair]) url+= "&hint="+this._hints[pair];
|
if (this._hints[pair]) url+= "&hint="+this._hints[pair];
|
||||||
}
|
}
|
||||||
if (isFinal) url+="&instructions=true";
|
if (isFinal) url+="&instructions=true";
|
||||||
this.requestJSONP(url+"&jsonp=");
|
this.requestCORS(url);
|
||||||
},
|
},
|
||||||
gotRoute: function(router,data) {
|
gotRoute: function(router,data) {
|
||||||
if (data.status==207) {
|
if (data.status==207) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue