Leaflet spinner load / load-end indicator with spinner.js, leaflet.ajax and leaflet.spin
HTML
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css">
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="http://calvinmetcalf.github.io/leaflet-ajax/dist/leaflet.ajax.js"></script>
<script src="http://calvinmetcalf.github.io/leaflet-ajax/example/leaflet.spin.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js"></script>
<h3>Leaflet spinner load / load-end indicator with spinner.js, leaflet.ajax and leaflet.spin</h3><input type="button" value="Reload Layer" onclick="reload()" />
<br/><br/>
<div id="map"></div>
CSS
#map {
height: 500px;
}
JavaScript
var map = L.map('map').setView([40.5804, -74.1375], 12);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var geojson_layer = new L.GeoJSON.AJAX("https://gist.githubusercontent.com/anonymous/264fdd9de2f41d2536de/raw/2c35bf05677071d27dca2c8f94b89287dc24ed06/test.geojson", {}).addTo(map);
console.log('hola');
console.log(geojson_layer);
reload=function ()
{geojson_layer.refresh();}