JavaScript AJAX Basics (retiring) AJAX and APIs Stage 4 Challenge Answer

Stage 4 Challenge Answer - number of photos loaded

I'm probably missing something obvious, but how does the webpage know when to stop loading photos from flickr? I'm assuming when I search 'cat', there are millions of them- what causes only the first 12? to show/load on my page. And along the same lines, are these being hidden, or not loading at all?

2 Answers

Dave McFarland
Dave McFarland
Treehouse Teacher

Hi Chris Shaughnessy

The public Flickr photo stream returns the 20 most recent photos that match the search. No more, no less. The public stream is pretty limited, but is VERY easy to use. The more advanced Flickr API offers many more options including the ability to get older photos and more photos. However, this API should be used with server-side code like PHP, Ruby or Python, because it requires an API key that you wouldn't want to have visible in a JavaScript file.

Got it! Thanks- I didn't think about checking the public stream criteria. Great course by the way!