How to handle ajax cancellation of pending requests _ php skills

Source: Internet
Author: User
Ajax cancels the processing of pending requests. if you need ajax, you can refer to the following situation when switching the Tab: click the tab1 option, the server sends an Ajax request to obtain the content data of tab1. If the request is being processed and you click the tab2 option in the process and send a new request, the server now has two pending requests. The result displayed on the page is that the content data of the tab1 option is displayed first when the data content is displayed, and then the content of the tab2 option is displayed. In this case, we should cancel the tab1 pending request and only allow the current (tab2) request to be processed to create a new index.html code as follows:

The code is as follows:



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.