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 trialstanislavmilev
Courses Plus Student 14,723 PointsCan somebody please explain in details what jsoncallback=? does under the hood and how to send JSONP requests w/o jQuery
I have noticed jsoncallback=? param gets the value of smth like: JQuery_1234345345234234 during the execution time. Does anybody know what exactly is happening under the hood and how jsonp works? It'd be also great if somebody could explain how to achieve the same in pure JavaScript.
1 Answer
Carlos Lantigua
5,938 PointsI also do not believe it fetches any additional files. It only pulls the data that you're requesting in your callback when it is needed so you won't see any additional files in this case since the files are on their server (which is where you're pulling it from). It just returns data in format that is more readable to JavaScript as appose to the XML format that it will send out if you do not add the json call back. The jsonp is simply a JQuery parse so that you don't have to type it in manually the way you would with JavaScript.
stanislavmilev
Courses Plus Student 14,723 Pointsstanislavmilev
Courses Plus Student 14,723 PointsI also did not notice any new JS files being fetched. My understanding that the lecturer said JSONP is a way of making AJAX requests through a .js file.