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

why is the ?jsoncallback=? link is in XML format when you open it?

https://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=? like its kinda confusing that we are going to work with js objetcs.. and this link is in XML format. also copied the exact link from the finished project from workspace (untouched). i was thinking i may have made any mistake in the link but it doesn't looks like it. so help me out on this one lol

1 Answer

Dustin Henry
Dustin Henry
7,392 Points

That link wouldn't let you bypass security prootocols in the browser to access the Flickr API. ?jsoncallback=? Is what lets you bypass the same domain restriction browsers have. There's a video in the first stage of the course for more info, but without the query string the AJAX request will fail. Think of the jsoncallback string as the key into the site and format: "json" as what is letting you get the data back in json format. Without jsoncallback you would not be able to bypass the browser security protocol and without specifying the format Flickr is going to send you the data in XML as its default even though you are accessing a json version of the data.