i´m using getJSON to draw points in leaflet, this is the code:
function cargarpapes(movibles){ $.getJSON("papeleras1.php", function(data) { papesjson = L.geoJson(data, { onEachFeature: function (feature, layer) { layer.bindPopup(feature.properties.codigo); } }); papesjson.addTo(map); });}my question is simple, why i can not use the method papesjson.addTo(map); out of $.getJSON(), even when i have declared my variable papesjson as global at first
Thanks!
أكثر...
function cargarpapes(movibles){ $.getJSON("papeleras1.php", function(data) { papesjson = L.geoJson(data, { onEachFeature: function (feature, layer) { layer.bindPopup(feature.properties.codigo); } }); papesjson.addTo(map); });}my question is simple, why i can not use the method papesjson.addTo(map); out of $.getJSON(), even when i have declared my variable papesjson as global at first
Thanks!
أكثر...