Working with APIs using AJAX and JSON
Code
$(document).ready(function() {
}); // end ready
Explanation:
$(document).ready(function() {
});
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
$.getJSON(flickerAPI, flickrOptions, displayPhotos);
.getJSON(url, data, callback);