Home > Web Front-end > JS Tutorial > Regarding multiple request issues with ajax

Regarding multiple request issues with ajax

韦小宝
Release: 2017-12-30 19:11:47
Original
1798 people have browsed it

The following editor will bring you an article about multiple requests for ajax. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. If you are interested in ajax, please follow the editor to see the multiple request issues about ajax

We may encounter when using ajax to request data Possibility of triggering multiple times with one click.

(For example: ajax's onreadystatechange event will be triggered multiple times; this is because onreadystatechange is an event handle.

Its value (state_Change) is a The name of the function , this function will be triggered when the state of the XMLHttpRequest object

## changes from 0 (uninitialized) to 4 (complete) only. We only execute the code when the state is 4. "

This function will be triggered every time the state of the XMLHttpRequest object changes.

It will be triggered 4 times in total, from 0 to 4. ) [PS: Of course, the examples cited in

here are not entirely consistent with the problems encountered at work] At this time, we need a method to terminate the program

exit and abort. Both are functions used to terminate the program. Let’s talk about the differences between the two.

##exit will do some release work:

Release all static global objects, cache, close all I/O channels, and then terminate the program. If there is a function registered through atexit, the registered function will also be called. . However, if the atexit function throws an exception, terminate will be called directly. ##abort:

Terminate the program immediately without any cleanup work. ##The above is the entire content of the multiple ajax request issues brought to you by the editor. I hope you will support the PHP Chinese website~Related recommendations:

Example details the principle of Ajax cross-domain request

Example explains in detail the method of ajax to obtain the weather of the user's location

ajax sends an asynchronous request Four steps

The above is the detailed content of Regarding multiple request issues with ajax. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template