From 4bcea473ebb16d598f9f2953700f8a3fbd570404 Mon Sep 17 00:00:00 2001 From: Petr Sloup Date: Wed, 9 Sep 2015 10:11:22 +0200 Subject: [PATCH] Fix reprojection-by-code example in IE9 by using JSONP --- examples/reprojection-by-code.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/examples/reprojection-by-code.js b/examples/reprojection-by-code.js index 07a94a3175..9f24efcb8d 100644 --- a/examples/reprojection-by-code.js +++ b/examples/reprojection-by-code.js @@ -65,25 +65,29 @@ function setProjection(code, name, proj4def, bbox) { function search(query) { resultSpan.innerHTML = 'Searching...'; - $.ajax('http://epsg.io/?format=json&q=' + query).then(function(response) { - if (response) { - var results = response['results']; - if (results && results.length > 0) { - for (var i = 0; i < results.length; i++) { - var result = results[i]; - if (result) { - var code = result['code'], name = result['name'], - proj4def = result['proj4'], bbox = result['bbox']; - if (code && code.length > 0 && proj4def && proj4def.length > 0 && - bbox && bbox.length == 4) { - setProjection(code, name, proj4def, bbox); - return; + $.ajax({ + url: 'http://epsg.io/?format=json&q=' + query, + dataType: 'jsonp', + success: function(response) { + if (response) { + var results = response['results']; + if (results && results.length > 0) { + for (var i = 0; i < results.length; i++) { + var result = results[i]; + if (result) { + var code = result['code'], name = result['name'], + proj4def = result['proj4'], bbox = result['bbox']; + if (code && code.length > 0 && proj4def && proj4def.length > 0 && + bbox && bbox.length == 4) { + setProjection(code, name, proj4def, bbox); + return; + } } } } } + setProjection(null, null, null, null); } - setProjection(null, null, null, null); }); }