The client web page is responsible for creating the XmlHttpRequest,and therefore the connection from the web page to some application on the server.
Part of this connection identifies how the response can / should be provided to the client code – via the use of a “callback”routine.
The callback routine is invoked multiple times with a status code, indicating the reason for the invocation.
If the request can be successfully completed by the server application, a responce should also be provided.