changed jsonp call, so that position of the callback command has
to be given as "%jsonp" in the string
This commit is contained in:
parent
7ad253732a
commit
1da10942d5
@ -43,7 +43,7 @@ call: function(marker_id, query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//build request for geocoder
|
//build request for geocoder
|
||||||
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&q=" + query;
|
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json&json_callback=%jsonp" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&q=" + query;
|
||||||
OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} );
|
OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} );
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ updateAddress: function(marker_id, do_fallback_to_lat_lng) {
|
|||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&accept-language="+OSRM.Localization.current_language + "&lat=" + lat + "&lon=" + lng;
|
var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json&json_callback=%jsonp" + "&accept-language="+OSRM.Localization.current_language + "&lat=" + lat + "&lon=" + lng;
|
||||||
OSRM.JSONP.call( call, OSRM.Geocoder._showReverseResults, OSRM.Geocoder._showReverseResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_"+marker_id, {marker_id:marker_id, do_fallback: do_fallback_to_lat_lng} );
|
OSRM.JSONP.call( call, OSRM.Geocoder._showReverseResults, OSRM.Geocoder._showReverseResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_"+marker_id, {marker_id:marker_id, do_fallback: do_fallback_to_lat_lng} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
// OSRM JSONP call wrapper
|
// OSRM JSONP call wrapper
|
||||||
// [wrapper for JSONP calls with DOM cleaning, fencing, timout handling]
|
// [wrapper for JSONP calls with DOM cleaning, fencing, timout handling]
|
||||||
|
|
||||||
xxx="test";
|
|
||||||
OSRM.JSONP = {
|
OSRM.JSONP = {
|
||||||
|
|
||||||
// storage to keep track of unfinished JSONP calls
|
// storage to keep track of unfinished JSONP calls
|
||||||
@ -67,15 +66,15 @@ OSRM.JSONP = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// clean DOM
|
// clean DOM
|
||||||
//var jsonp = document.getElementById('jsonp_'+id);
|
var jsonp = document.getElementById('jsonp_'+id);
|
||||||
//if(jsonp)
|
if(jsonp)
|
||||||
// jsonp.parentNode.removeChild(jsonp);
|
jsonp.parentNode.removeChild(jsonp);
|
||||||
|
|
||||||
// add script to DOM
|
// add script to DOM
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
//script.id = 'jsonp_'+id;
|
script.id = 'jsonp_'+id;
|
||||||
script.src = source + "&json_callback=OSRM.JSONP.callbacks."+id + "&jsonp=console.log(xxx);OSRM.JSONP.callbacks."+id;
|
script.src = source.replace(/%jsonp/,"OSRM.JSONP.callbacks."+id);
|
||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
|
|
||||||
// start timeout timer
|
// start timeout timer
|
||||||
|
@ -132,7 +132,7 @@ draggingTimeout: function() {
|
|||||||
|
|
||||||
_buildCall: function() {
|
_buildCall: function() {
|
||||||
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
var source = OSRM.DEFAULTS.HOST_ROUTING_URL;
|
||||||
source += '?z=' + OSRM.G.map.getZoom() + '&output=json&geomformat=cmp';
|
source += '?z=' + OSRM.G.map.getZoom() + '&output=json&jsonp=%jsonp&geomformat=cmp';
|
||||||
if(OSRM.G.markers.checksum)
|
if(OSRM.G.markers.checksum)
|
||||||
source += '&checksum=' + OSRM.G.markers.checksum;
|
source += '&checksum=' + OSRM.G.markers.checksum;
|
||||||
for(var i=0,size=OSRM.G.markers.route.length; i<size; i++) {
|
for(var i=0,size=OSRM.G.markers.route.length; i<size; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user