Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
STAFF
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!