Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.     $.ajax({
  2.       url: '/ao16/get-heat-map',//url of the function, this should be set in urls.py
  3.       dataType: 'json',
  4.       jsonpCallback: 'getJson',
  5.       beforeSend: function() {
  6.         $('#loader').show();
  7.       },
  8.       success: function(response) {
  9.         $('#loader').hide();
  10.         if (checked && heat == null){
  11.           heat = L.heatLayer(response.proposed_roads, {
  12.               radius: 25,
  13.               blur: 25,
  14.               gradient: {
  15.                 0.47: 'blue',
  16.                 0.67: 'lime',
  17.                 1.0: 'red'
  18.               }
  19.           }).addTo(map);
  20.         }else if (checked){
  21.           map.addLayer(heat)
  22.         }
  23.       }
  24.     })