In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge points of this article "how to use the converter of $.ajax () in jQuery", so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this article "how to use the converter of $.ajax () in jQuery".
Starting with jQuery 1.5, jQuery's Ajax implementation includes pre-prefilters, transports and transport, giving you more flexibility to extend Ajax. For information about these advanced features, see Extending Ajax
Using Converters (using converters)
The data types supported by the converter of $.ajax () map to other data types. However, if you want to map a custom data type to a known type (json, etc.), you must add a relevant conversion function between the response Content-Type and the actual data type with the contents option:
$.ajaxSetup ({
Contents: {
Mycustomtype: / mycustomtype/
}
Converters: {
"mycustomtype json": function (result) {
/ / do stuff
Return newresult
}
}
})
This extra object is necessary because there is never a strict one-to-one correspondence between the response content type (Content-Types) and the data type (regular expressions represent the results).
Convert a supported type (such as text, json) to a custom data type, and then return, using another pass-through converter:
$.ajaxSetup ({
Contents: {
Mycustomtype: / mycustomtype/
}
Converters: {
"text mycustomtype": true
"mycustomtype json": function (result) {
/ / do stuff
Return newresult
}
}
})
Now the above code allows you to convert from text to mycustomtype, and then mycustomtype to json.
The above is about the content of this article on "how to use the converter of $.ajax () in jQuery". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to 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.
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.