]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/query.js
Abort any existing requests when starting new ones
[rails.git] / app / assets / javascripts / index / query.js
index bc4c26771913e6f4fbb855fc3b7064400b0f0482..fb8649025328af184e9b5aa60e919941a4bd0d36 100644 (file)
@@ -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) {