Multiple ajax requests

Source: Internet
Author: User

Multiple ajax requests

When we use ajax to request data, we may encounter the possibility of triggering multiple clicks at a time.

(For example, the onreadystatechange event of ajax is triggered multiple times, because onreadystatechange is an event handle.

Its value (state_Change) is the name of a function. This function is triggered when the status of the XMLHttpRequest object changes.

The status changes from 0 (uninitialized) to 4 (complete. The code is executed only when the status is 4 ."

This function is triggered every time the status of the XMLHttpRequest object changes.

It will be triggered four times in total, from 0 to 4 .) [PS: Of course, the example cited here does not fully meet the problem encountered at work.] at this time, we need a method to terminate the program.

Both exit and abort are functions used to terminate the program. The differences between the two are described below.

Exit will do some release work:Release all static global objects, cache, disable all I/O channels, and terminate the program. If a function is registered through atexit, the registered function is also called. However, if the atexit function throws an exception, it will directly call terminate.

Abort:Terminate the program immediately without any cleanup.

The above is all the content about ajax's multiple requests. I hope you can provide more support ~

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.