In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use jQuery.param". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use jQuery.param.
The input element is also a serialized element in jQuery 1.4 HTML5.
We can display a query string for an object and a corresponding URI-decoded version, as follows:
Var myObject = {
A: {
One: 1
Two: 2
Three: 3
}
B: [1,2,3]
}
Var recursiveEncoded = $.param (myObject)
Var recursiveDecoded = decodeURIComponent ($.param (myObject))
Alert (recursiveEncoded)
Alert (recursiveDecoded)
The results of recursiveEncoded and recursiveDecoded are as follows:
A%5Bone%5D=1&a%5Btwo%5D=2&a%5Bthree%5D=3&b%5B%5D=1&b%5B%5D=2&b%5B%5D=3
A [one] = 1 & a [two] = 2 & a [three] = 3 [] = 1 [] = 2 [] = 3
Before jQuery1.4, to mimic the behavior of $.param (), we can set the traditional parameter to true:
Var myObject = {
A: {
One: 1
Two: 2
Three: 3
}
B: [1,2,3]
}
Var shallowEncoded = $.param (myObject, true)
Var shallowDecoded = decodeURIComponent (shallowEncoded)
Alert (shallowEncoded)
Alert (shallowDecoded)
The results of shallowEncoded and shallowDecoded are as follows:
A=%5Bobject+Object%5D&b=1&b=2&b=3
A = [object + Object] & b=1&b=2&b=3
Example:
Example: serialize a key/value object. / span >
Div {color:red;}
Var params = {width:1680, height:1050}
Var str = jQuery.param (params)
$("# results") .text (str)
Demo:
Example: serial number of some complex objects
/ / = 1.4:
$.param ({a: [2helm 3jue 4]}) / / "a [] = 2yoga [] = 3beaua [] = 4"
/ / = 1.4:
$.param ({a: {bburet 1 magnificent cjoun 2}, d: [3pr 4, {evision 5}]}) / / "a [b] = 1 & a [c] = 2d [] = 3d [] = 4fud [2] [e] = 5"
At this point, I believe you have a deeper understanding of "how to use jQuery.param". 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.
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.