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 ~