In this exercise, we'll change our code to fetch the data from Flickr when the page loads, rather than using a previously downloaded file. As you'll see, this is quite straightforward.
Recall that when we switched over to the static JSON data, we entered the following URL into our browser to download the JSON data:
We should be able to use this URL with our
$.ajax
function and load data directly from the live feed rather than our static file. Go ahead and modify the URL:$.ajax({ url: 'http://api.flickr.com/services/feeds/geo/?format=json&tags=bird', dataType: 'jsonp', jsonpCallback: 'jsonFlickrFeed', success: successHandler });
Reload the browser and you should see different photos loaded than in your saved JSON file.