I have problem with fetchData function.(from Question: Openlayers 3 , What is the equivelent of layer.redraw(true)?)
I need refresh my vectorSource every 50 seconds
my code:
var vectorLoader = function(extent, resolution, projection) {var url = 'http://xxxx:8080/geoserver/ant_mapy/wfs?service=WFS&' + 'version=2.0.0&request=GetFeature&typename=ant_mapy:v_wezel_rfid&' + 'outputFormat=text/javascript&format_options=callback:loadFeatures' + '&srsname=EPSG:3857&bbox=' + extent.join(',') + ',EPSG:3857';$.ajax({ url: url, dataType: 'jsonp'});}; var vectorSource = new ol.source.ServerVector({format: new ol.format.GeoJSON(),loader: vectorLoader,strategy: ol.loadingstrategy.createTile(new ol.tilegrid.XYZ({ maxZoom: 19}))});var loadFeatures = function(response) {var features = vectorSource.readFeatures(response);vectorSource.addFeatures(features); }; var fetchData = function() { var url = 'http://xxxx:8080/geoserver/ant_mapy/wfs?service=WFS&' + 'version=2.0.0&request=GetFeature&typename=ant_mapy:v_wezel_rfid&' + 'outputFormat=text/javascript&format_options=callback:loadFeatures' + '&srsname=EPSG:3857';$.ajax(url,{ dataType: 'jsonp', success: function (data, textStatus, jqXHR) { vectorSource.clear(); vectorSource.addFeatures(vectorSource.readFeatures(data)); }, error: function (jqXHR, textStatus, errorThrown) { console.log(errorThrown); } });//call this again in 50 seconds timeupdateTimer = setTimeout(function () { fetchData();}, 50000);};and on the end script I call:
fetchData(); I receive on console:
Error: jQuery111109142307578586042_1424260440497 was not called {stack: (...), message: "jQuery111109142307578586042_1424260440497 was not called"}and features are added to map but no clear(), how to fix it.
Any help will be highly appreciated
Ps. I have fresh: jquery-latest.min.js
أكثر...
I need refresh my vectorSource every 50 seconds
my code:
var vectorLoader = function(extent, resolution, projection) {var url = 'http://xxxx:8080/geoserver/ant_mapy/wfs?service=WFS&' + 'version=2.0.0&request=GetFeature&typename=ant_mapy:v_wezel_rfid&' + 'outputFormat=text/javascript&format_options=callback:loadFeatures' + '&srsname=EPSG:3857&bbox=' + extent.join(',') + ',EPSG:3857';$.ajax({ url: url, dataType: 'jsonp'});}; var vectorSource = new ol.source.ServerVector({format: new ol.format.GeoJSON(),loader: vectorLoader,strategy: ol.loadingstrategy.createTile(new ol.tilegrid.XYZ({ maxZoom: 19}))});var loadFeatures = function(response) {var features = vectorSource.readFeatures(response);vectorSource.addFeatures(features); }; var fetchData = function() { var url = 'http://xxxx:8080/geoserver/ant_mapy/wfs?service=WFS&' + 'version=2.0.0&request=GetFeature&typename=ant_mapy:v_wezel_rfid&' + 'outputFormat=text/javascript&format_options=callback:loadFeatures' + '&srsname=EPSG:3857';$.ajax(url,{ dataType: 'jsonp', success: function (data, textStatus, jqXHR) { vectorSource.clear(); vectorSource.addFeatures(vectorSource.readFeatures(data)); }, error: function (jqXHR, textStatus, errorThrown) { console.log(errorThrown); } });//call this again in 50 seconds timeupdateTimer = setTimeout(function () { fetchData();}, 50000);};and on the end script I call:
fetchData(); I receive on console:
Error: jQuery111109142307578586042_1424260440497 was not called {stack: (...), message: "jQuery111109142307578586042_1424260440497 was not called"}and features are added to map but no clear(), how to fix it.
Any help will be highly appreciated
Ps. I have fresh: jquery-latest.min.js
أكثر...