JavaScript AJAX Basics (retiring) AJAX Concepts A Simple AJAX Example

Mayank Munjal
Mayank Munjal
Front End Web Development Techdegree Graduate 18,120 Points

So xhr.onreadystangechange is the callback function but I'm getting confused as to when it is called back?

I don't see a higher order function using the callback function as an argument so if someone can explain what's going on, it will help a lot!

1 Answer

Steven Parker
Steven Parker
170,448 Points

The callback function is used by an internal event handler that is established by the "xhr.send()" call. It accesses the callback directly as a property of the "xhr" object instead of having it passed as an argument.