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)