var map;
var objectLayer;
+var objectLoader;
var layers = [
{
}
function addObjectToMap(object, zoom, callback) {
+ if (objectLoader) {
+ objectLoader.abort();
+ }
+
if (objectLayer) {
map.removeLayer(objectLayer);
}
- $.ajax({
+ objectLoader = $.ajax({
url: OSM.apiUrl(object),
dataType: "xml",
success: function (xml) {