Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!