diff --git a/lib/OpenLayers/Tile/UTFGrid.js b/lib/OpenLayers/Tile/UTFGrid.js index 1dc66454d0..35151dba10 100644 --- a/lib/OpenLayers/Tile/UTFGrid.js +++ b/lib/OpenLayers/Tile/UTFGrid.js @@ -95,6 +95,8 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, { var ols = new OpenLayers.Protocol.Script({ url: this.url, callback: function(response) { + this.isLoading = false; + this.events.triggerEvent("loadend"); this.json = response.data; }, scope: this @@ -104,7 +106,13 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, { // Use standard XHR OpenLayers.Request.GET({ url: this.url, - callback: this.parseData, + callback: function(response) { + this.isLoading = false; + this.events.triggerEvent("loadend"); + if (response.status === 200) { + this.parseData(response); + } + }, scope: this }); } @@ -122,12 +130,10 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, { * {Object} parsed javascript data */ parseData: function(req) { - if (req.status == 200) { - if (!this.format) { - this.format = new OpenLayers.Format.JSON(); - } - this.json = this.format.read(req.responseText); - } + if (!this.format) { + this.format = new OpenLayers.Format.JSON(); + } + this.json = this.format.read(req.responseText); }, /**