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!
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
eslam saidCourses Plus Student 6,734 Points
The callback function
I just wanna be sure that i get it, so as i understood that the callback function is where we put what we wanna do after we get a response from a server,
so the first step i must create XHR object to tell the browser that i wanna use ajax
then the callback function it
s like im saying to the server after getting a response do 1 and 2 and 3 am i right ?
Ivan Penchev13,833 Points
While technically you are right, i would look at this official description for reference:
A function that takes other functions as arguments or returns functions as its result is called a higher-order function, and the function that is passed as an argument is called a callback function. It's named “callback” because at some point in time it is “called back” by the higher-order function.
This may sound a bit fleshy, but its important to understand where exactly is a callback placed in the hierarchy.