Home > Article > Web Front-end > What are the jquery ajax callback functions?
The callback functions are: 1. beforeSend(), called before sending the request; 2. error(), called when the request fails; 3. dataFilter(), called after the request is successful; 4. success() ), called after the request; 5. complete(), called after the request is completed.
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
The callback functions of ajax in jquery include: beforeSend, error, dataFilter, success, and complete. The data obtained by $.ajax() can be processed in these callback functions.
beforeSend
Call before sending the request, and pass in an XMLHttpRequest as a parameter.
error
Called when a request error occurs. Pass in an XMLHttpRequest object, a string describing the error type, and an exception object (if any).
dataFilter
Called after the request is successful. Pass in the returned data and the value of the "dataType" parameter. And must return new data (possibly processed) passed to the success callback function.
success
Called after request. Pass in the returned data and a string containing the success code.
complete
This function is called when the request is completed, regardless of success or failure. Pass in an XMLHttpRequest object, and a string containing a success or error code.
[Related tutorial recommendations: AJAX video tutorial]
The above is the detailed content of What are the jquery ajax callback functions?. For more information, please follow other related articles on the PHP Chinese website!