Jackson Park Birding
  • Home
  • Recent Sightings
  • Getting to Jackson Park
jQuery code on the sightings page used to pull data using the eBird API 2.0.


<div class = "output"></div>
<script>

function getallbirds(days) {
var settings = {
  "url": "https://ebird.org/ws2.0/data/obs/geo/recent?lat=41.78&lng=-87.58&dist=2&back=" + days + "&sort=species",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "X-eBirdApiToken": "YOURTOKENHERE"
  },
};
var data = {}
$.ajax(settings).done(function (response) {
  data = response;
  $( "div.output" ).html("");
  $( "div.output" )
  .append(data[0].comName + "<br />");
  for(i = 1; i < data.length; i++) {
  $( "div.output" )
  .append(data[i].comName+"<br />");
  }  
$( "div.output" ).css("font-family", "Times New Roman");
 
}); }

 
getallbirds(5);
</script>
<button onclick = "getallbirds(5)"> last 5 days</button>
<button onclick = "getallbirds(10)"> last 10 days</button>
<button onclick = "getallbirds(15)"> last 15 days</button>
<button onclick = "getallbirds(20)"> last 20 days</button>
Proudly powered by Weebly
  • Home
  • Recent Sightings
  • Getting to Jackson Park