In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to use post and jqXHR objects". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor learn how to use post and jqXHR objects.
The jqXHR Object (jqXHR object)
Starting with jQuery 1.5, all jQuery's Ajax methods return a superset of XMLHTTPRequest objects. This jQuery XHR object, or "jqXHR," returned through the $. Get () method, implements the Promise interface so that it has all the properties, methods, and behaviors of Promise (see Deferred object for more information). The jqXHR.done () (for success), jqXHR.fail () (for error), and jqXHR.always () (for completion, success or error) methods accept a function argument to be called when the request is terminated. For more information about the parameters that this function receives, see the $.ajax () section in the jqXHR Object documentation.
The Promise interface also allows jQuery's Ajax methods, including $.get (), to be associated with .done (), .fail (), and .always () callbacks in a separate request, and even allows you to assign callbacks after the request has been completed. If the request has been completed, the callback function is called immediately.
/ / Assign handlers immediately after making the request
/ / and remember the jqxhr object for this request
Var jqxhr = $.post ("example.php", function () {
Alert ("success")
})
.success (function () {alert ("second success");})
.error (function () {alert ("error");})
.complete (function () {alert ("complete");})
/ / perform other work here...
/ / Set another completion function for the request above
Jqxhr.complete (function () {alert ("second complete");})
Deprecation Notice (recommended precautions:)
The jqXHR.success (), jqXHR.error (), and jqXHR.complete () callback methods were introduced in jQuery 1.5, but are not recommended in jQuery 1.8 and are obsolete. They will eventually be canceled (removed), and your code should be ready for the second time, using jqXHR.done (), jqXHR.fail (), and jqXHR.always () instead.
At this point, I believe you have a deeper understanding of "how to use post and jqXHR objects". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.