Home  >  Article  >  Web Front-end  >  What are the jquery ajax callback functions?

What are the jquery ajax callback functions?

青灯夜游
青灯夜游Original
2021-12-29 18:43:224628browse

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.

What are the jquery ajax callback functions?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn