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) jQuery and AJAX Posting Data with jQuery

Vlad Legkowski
Vlad Legkowski
9,882 Points

Response as parameter in the last function?

Why do we need a parameter 'response' in the last function? So it will stare data as JSON?

1 Answer

Craig Campbell
Craig Campbell
14,428 Points

the callback takes the response object as input. It's just the syntax they chose to use for AJAX with jQuery . The response object is what the server sends back in the response part of the request-response cycle. you need to take this as input into the function so your machine can access the object and extract data out of it.

Craig Campbell
Craig Campbell
14,428 Points

you need to take this as input into the function so your FUNCTOIN can access the object and extract data out of it and the make decisions based upon that data (whatever you want your computer to do with that data)