jquery implements methods for monitoring all AJAX requests on a page _jquery

Source: Internet
Author: User

This article illustrates the way in which jquery implements all AJAX requests for monitoring pages. Share to everyone for your reference, specific as follows:

Do you have a problem with a page that launches two AJAX requests and wants them to succeed and then do one more action?

The easy way to think of the solution is to wait for one of the ends and then start another one, which is done with a callback function.

However, if one of the AJAX request code is not you write, you can not change, how to do?

Or, you just want to know when a URL request to end, do not want to control other requests, how to do?

<!
    DOCTYPE html>  

Other related functions:

In $.ajax:

Error: Called when an error occurs, can be used to escalate the wrong request.
Complete: Both success and failure will be invoked

In the high version:

$.promise
$.when

I hope this article will help you with the jquery program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.