Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the jqXHR object of jQuery.getJSON

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "what is the jqXHR object of jQuery.getJSON", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "what is the jqXHR object of jQuery.getJSON?"

If the URL contains the string "callback=?" (or similar parameters, depending on how the server-side API is defined), the request is considered to be in JSONP form. For more details on jsonp data types, see $.ajax ().

The jqXHR Object (jqXHR object)

Note: it is estimated that the jQuery official did not update this api in time, which is different from the description of the jqXHR object in jQuery.get () api.

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). For ease of use in $.ajax (), the jQuery XHR object $.ajax () also provides .error () .success () and .complete () methods. These methods take a function argument that is called when the request is terminated. This function takes the same parameters as the callback function name of $.ajax ().

The Promise interface also allows jQuery's Ajax methods, including $.getJSON (), to be associated with .success (), .complete (), and .error () 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 = $.getJSON ("example.json", 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");})

The above is all the content of the article "what is the jqXHR object of jQuery.getJSON?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report