From 97b1196dcb93b23f15ca94633dec7919e47a1fe2 Mon Sep 17 00:00:00 2001 From: john gravois Date: Tue, 26 Apr 2016 08:48:21 -0700 Subject: [PATCH] create script tag after JSONP callback function is defined (#772) --- src/Request.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 {