title: Pull GeoJSON data into Leaflet with AJAX call
body: <p>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 <a href="https://nycopendata.socrata.com/Media/Wifi-Hotspot-Locations/ehc4-fktp">this data set</a>. 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.</p>
  
  <p>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?</p>
  
  <pre><code>&lt;script src="museums.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  // 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 &amp;&amp; e.properties.name){
      e.layer.bindPopup(e.properties.name);
  }
  });
  
  geojsonLayer.addGeoJSON(data);
  
  // Add the GeoJSON layer
  map.addLayer(geojsonLayer);
  &lt;/script&gt;
  </code></pre>