614 Part IV: Appendixes
OptionDescriptionDefaultExampleonLoading : functionCallback that is invoked when thexhr.readyState == 3. This occurs when
the data begins to come back. Passes the request object.null onLoading : showLoadonOpen : functionCallback that is called when thexhr.readyState == 1. This occurs after
xhr.open(). Passes the request object.
null onOpen : showOpenonPrefetch : functionCallback that is invoked when you are prefetching data but not yet using it.function () {}onPrefetch : updateCacheonProgress : functionCallback invoked by default once every second. Useful for updating the user on the progress of long requests. Often used with the status object. You can override the defaultprogressIntervalof one secondif desired.function () {}onProgress : showProgressonReceivedCallback that corresponds toreadyState4
but without having looked at the success
or failure of the request yet, thus it will be called beforeonSuccessoronFail.null onReceived : inspectonRetry : functionCallback function that is called whenretryis enabled. Called every time a retry occurs.function () {}onRetry : showRetryonSent : functionCallback that is called when thexhr.readyState = 2. This occurs right after
xhr.send(). Passes the request object.
null onSent : showSentonStatus: functionCallback that is invoked for the corresponding status code. For example, the callback foron404is called whena response of 404 is received, while an on500is called when a 500 response codeis received.undefined on404 : reportBrokenLinkon500 : stopCommonSuccess : functionPrimary callback that will be called whenever the request completes successfully with a status of 200. Passes the response object as a parameter.function () {}onSuccess : showSuccessTABLEC-2Options Object Properties for Making Requests (continued)