diff --git a/plugins/layer_types/openlayers_layer_type_geojson.js b/plugins/layer_types/openlayers_layer_type_geojson.js index c2a5458..a3eae5e 100644 --- a/plugins/layer_types/openlayers_layer_type_geojson.js +++ b/plugins/layer_types/openlayers_layer_type_geojson.js @@ -51,13 +51,16 @@ Drupal.openlayers.layer.geojson = function(title, map, options) { var layer = new OpenLayers.Layer.Vector(title, options); // Use an AJAX like call to get data from URL - OpenLayers.loadURL(options.url, {}, null, function (response) { - var format = new OpenLayers.Format.GeoJSON(geojson_options); - var features = format.read(response.responseText); - // Add features, if needed - if (features) { - layer.addFeatures(features); - layer.events.triggerEvent('loadend'); + OpenLayers.Request.GET({ + url: options.url, + callback: function (response) { + var format = new OpenLayers.Format.GeoJSON(geojson_options); + var features = format.read(response.responseText); + // Add features, if needed + if (features) { + layer.addFeatures(features); + layer.events.triggerEvent('loadend'); + } } }); } diff --git a/plugins/layer_types/openlayers_layer_type_kml.js b/plugins/layer_types/openlayers_layer_type_kml.js index 0651d4e..fe062ff 100644 --- a/plugins/layer_types/openlayers_layer_type_kml.js +++ b/plugins/layer_types/openlayers_layer_type_kml.js @@ -21,13 +21,16 @@ Drupal.openlayers.layer.kml = function(title, map, options) { kml_options.externalProjection = new OpenLayers.Projection(options.projection); // Use an AJAX like call to get data from URL - OpenLayers.loadURL(options.url, {}, null, function (response) { - var format = new OpenLayers.Format.KML(kml_options); - var features = format.read(response.responseText); - // Add features, if needed - if (features) { - layer.addFeatures(features); - layer.events.triggerEvent('loadend'); + OpenLayers.Request.GET({ + url: options.url, + callback: function (response) { + var format = new OpenLayers.Format.KML(kml_options); + var features = format.read(response.responseText); + // Add features, if needed + if (features) { + layer.addFeatures(features); + layer.events.triggerEvent('loadend'); + } } });