So I'm trying to publish a MapBox map with Leaflet, and want to add some markers from an external data source with an AJAX call. Specifically, I'm mapping out all of the wifi spots in NYC with this data set. I see where it says I can download the wifi locations in JSON, but I'm still trying to teach myself how to code and don't know what to do from there.
Here's the example that MapBox gives using a .js hosted on your site directory. What would it look like if I were to do an AJAX call instead?
// Define a GeoJSON data layer with data
var geojsonLayer = new L.GeoJSON();
// Display the name property on click
geojsonLayer.on('featureparse', function (e) {
if (e.properties && e.properties.name){
e.layer.bindPopup(e.properties.name);
}
});
geojsonLayer.addGeoJSON(data);
// Add the GeoJSON layer
map.addLayer(geojsonLayer);