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

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.