diff --git a/src/Request.js b/src/Request.js index 467c16ebf..dd86427d6 100644 --- a/src/Request.js +++ b/src/Request.js @@ -159,14 +159,8 @@ export function request (url, params, callback, context) { export function jsonp (url, params, callback, context) { window._EsriLeafletCallbacks = window._EsriLeafletCallbacks || {}; var callbackId = 'c' + callbacks; - params.callback = 'window._EsriLeafletCallbacks.' + callbackId; - var script = L.DomUtil.create('script', null, document.body); - script.type = 'text/javascript'; - script.src = url + '?' + serialize(params); - script.id = callbackId; - window._EsriLeafletCallbacks[callbackId] = function (response) { if (window._EsriLeafletCallbacks[callbackId] !== true) { var error; @@ -192,6 +186,11 @@ export function jsonp (url, params, callback, context) { } }; + var script = L.DomUtil.create('script', null, document.body); + script.type = 'text/javascript'; + script.src = url + '?' + serialize(params); + script.id = callbackId; + callbacks++; return {