Abort any existing requests when starting new ones

This commit is contained in:
Tom Hughes 2014-03-13 22:59:36 +00:00
parent 5f970fe334
commit b87e60e0b6

View 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) {