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 Making the AJAX Request

Nicholas Woods
Nicholas Woods
6,260 Points

The data argument represents the JSON data returned by jQuery.

When Dave mentions this (title), does he mean the data argument returns what came back from our $getJSON() and because of this it is now in JavaScript format?

1 Answer

Hi Nicholas,

Around the 5:00 mark in the video Dave mentions that jQuery parses the returned JSON data for you and so by the time it is passed into your handler it is in javascript format ready for you to retrieve values from it.

Here's a quote from the jQuery docs, http://api.jquery.com/jquery.getjson/

The success callback is passed the returned data, which is typically a JavaScript object or array as defined by the JSON structure and parsed using the $.parseJSON() method. It is also passed the text status of the response.

I think that this is what Dave is referring to.

Nicholas Woods
Nicholas Woods
6,260 Points

Yea, so we are parsing to our function what the callback receives (which is an object in this case).