Notes

Working with APIs using AJAX and JSON

Edit on GitHub

JavaScript

Code

1$(document).ready(function() {
2
3}); // end ready

Explanation:

1$(document).ready(function() {
2
3});

tells the function to wait until the HTML for the page has completely loaded before running the JavaScript code placed inside it.

making an ajax request when a button is pushed

1$.getJSON(flickerAPI, flickrOptions, displayPhotos);
2.getJSON(url, data, callback);