In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the difference between readyState and status in jQuery". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The ajaxStop () function is used to bind the handler for the ajaxStop event requested by AJAX.
This is a global AJAX event function that executes the bound event handler function when the ajaxStop event is triggered.
JQuery official documentation description: whenever an AJAX request completes (regardless of success or failure), jQuery checks to see if there are other active (outstanding) AJAX requests. If no other active AJAX requests are found in the process, jQuery triggers the ajaxStop event. At this point, all event handlers bound by the ajaxStop () function will be executed.
In short, when an AJAX request ends and there are no other active AJAX requests, the request triggers the ajaxStop event.
In general, multiple AJAX requests are executed successively, and only the last AJAX request that ends will trigger the ajaxStop event. After all the AJAX requests have been executed, multiple AJAX requests are executed in succession again, or only the last one of the AJAX requests that ends will trigger the ajaxStop event.
If an AJAX request is prohibited from triggering a global AJAX event, it is not considered an active AJAX request.
This function must be called on the jQuery object instance, and ajaxStop () binds the event handler for each matching element. When the ajaxStop event is triggered, all handlers bound on the matching element will be called. The this within the event handler points to the current DOM element.
You can bind multiple event handlers by calling this function multiple times for the same element. When an event is triggered, jQuery executes the bound event handlers in the order in which they are bound.
Since jQuery 1.8, this function can only bind event handlers for document objects, and event handlers bound for other elements will not work.
If you set the option parameter global to false in jQuery.ajax () or jQuery.ajaxSetup (), you can prevent the AJAX request from firing the global AJAX event.
This function belongs to the jQuery object (instance).
Grammar.
This function is added to jQuery 1. 0.
JQueryObject.ajaxStop (handler)
Parameters.
Parameter description
The event handler function that needs to be executed when the handlerFunction type triggers the event.
Return value
The return value of the ajaxStop () function is of type jQuery and returns the current jQuery object itself.
Example & illustration
For the trigger mechanism of ajaxStop events and ajaxStop events, you can refer to part of the source code of the jQuery.ajax () function of jQuery.
From the following source code, we can know that jQuery counts the number of currently active AJAX requests. Each time an AJAX request is started, the number of active users is increased by 1; whenever an AJAX request ends, the number of active users is subtracted by 1. The ajaxStart event is triggered if an AJAX request starts with 0 active numbers, and the ajaxStop event is triggered if an AJAX request ends with 0 active numbers. / / the beginning of the jQuery.ajax () function
Var fireGlobals = s.global; / / whether global AJAX events are allowed to be triggered
/ / if a global AJAX event is allowed to be triggered and the number of active AJAX requests is 0, the ajaxStart event is triggered
If (fireGlobals & & jQuery.active++ = 0) {
JQuery.event.trigger ("ajaxStart")
}
/ /... Omit the intermediate source code
/ / the end of the jQuery.ajax () function
If (fireGlobals) {
GlobalEventContext.trigger ("ajaxComplete", [jqXHR, s])
/ / if global events are allowed to be triggered and the number of active AJAX requests is 0, the ajaxStop event is triggered
If (! (--jQuery.active)) {
JQuery.event.trigger ("ajaxStop")
}
}
This is the end of the content of "what is the difference between readyState and status in jQuery". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.