From: Tom Hughes Date: Thu, 13 Mar 2014 22:59:36 +0000 (+0000) Subject: Abort any existing requests when starting new ones X-Git-Tag: live~4282^2~21 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/b87e60e0b64340870818b140757f8219a7161212?ds=sidebyside Abort any existing requests when starting new ones --- diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index bc4c26771..fb8649025 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -176,7 +176,11 @@ OSM.Query = function(map) { $(this).show(); }); - $.ajax({ + if ($section.data("ajax")) { + $section.data("ajax").abort(); + } + + $section.data("ajax", $.ajax({ url: OSM.OVERPASS_URL, method: "POST", data: { @@ -213,7 +217,7 @@ OSM.Query = function(map) { .appendTo($ul); } } - }); + })); } function queryOverpass(lat, lng) {