jquery - Json file dosen't show up in google chrome -
i'm developing page shows json file via jquery , leaflet.
the flickr side working fine, when try $.getjson o, see error in chrome's console:
xmlhttprequest cannot load file:///c:/appserv/www/pfeleaflet/test%20geojson/lot.json. cross origin requests supported protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
but when try open .html page in firefox, json file shows up, work fine.
this code using:
var geolayer = l.geojson().addto(map); var geolist = l.control.geojsonlist(geolayer); geolist.on('item-active', function(e) { $('#selection').text(json.stringify(e.layer.feature.properties)); }) .addto(map); $('#geofile').on('change', function(e) { $.getjson(this.value, function(json) { map.removelayer(geolayer); geolayer = l.geojson(json).addto(map); map.fitbounds( geolayer.getbounds() ); geolist.reload( geolayer ); }); }).trigger('change');
any please.
suggest opening page on local server instead of using file protocol cause problems here , other places. nodejs serve great, or ruby's builtin http server.
here great list. https://gist.github.com/willurd/5720255
Comments
Post a Comment