Multiple request questions about Ajax _ajax related

Source: Internet
Author: User

When we request data with Ajax, we may experience a multiple-click trigger.

(for example, Ajax onreadystatechange events are triggered multiple times; This is because onReadyStateChange is an event handle.)

Its value (state_change) is the name of a function that triggers this function when the state of the XMLHttpRequest object changes.

The state varies from 0 (uninitialized) to 4 (complete). We execute the code only when the state is 4 o'clock. ”

This function is triggered each time the state of the XMLHttpRequest object changes.

It will trigger 4 times, from 0 to 4. PS: Of course, the examples quoted here do not fully conform to the problems encountered at work. At this point, we need a way to terminate the program.

Both exit and abort are functions that terminate the program, so let's talk about the differences between the two.

exit will do some release work: release all static global objects, cache, turn off all I/O channels, and then terminate the program. If a function is registered through ATEXIT, the registered function is also invoked. However, if the Atexit function throws an exception, the terminate is called directly.

Abort: immediately terminate the procedure without any cleanup work.

The above is a small series for you to bring to the many questions about Ajax request the whole content of the question, I hope that we support cloud Habitat Community ~

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.