jquery param ()

Source: Internet
Author: User

The Jquery.param () function is used to serialize a JS array or object into a string value, serialize the jquery object to a URL parameter according to Name/value or Key/value, and connect with &. For use in URL query strings or AJAX requests.


Grammar


$.param (Object,trad)


Parameter description


Object: Required. Specifies the array or object to serialize.

Trad: Optional. A Boolean value that specifies whether to use the traditional style of parameter serialization.

Instance

Var v1 = $.param ( true ); //  "" Var v2 = $.param ( 100  ); //  "" Var v3 = $.param ( 12.34 ); //  "" var v4 =  $.param (  ""  ); //  "" Var v5 = $.param ( function () { return  18; } ); //  "" Var v6 = $.param ( /\\d+/ ); //  "" Var v7 = $.param ( new date ()  ); //  "" Var v8 = $.param (  null ); //  error Var v9 = $.param ( undefined ); //  error//   string will be treated as a character array var v10 = $.param (  "name"  ); //  "0=n&1=a&2=m &3=e "Var v11 = $.param ({ name:" Codeplayer ", age:18 } ); // " Name=codeplayer&age=18 "var array = [    { name: " name ",  value:  "Zhang San"  },    { name:  "Age", value: 18, extra:  "ignore this attribute"  },     { name:  "Grade"  }, //  without the Value property, the value is undefined and will be converted to an empty string ""      { name:  "OrderId", value: 2 },    { name:  " OrderId ",  value: 3 },];var v12 = $.param ( array ); // " name= %e5%bc%a0%e4%b8%89&age=18&grade=&orderid=2&orderid=3 "// jquery each element of an array as an object, and call its name and Value property//  because these elements do not have the Name property, so for undefined, and to be converted to the string "undefined"//  because these elements do not have the Value property, so for undefined, and is converted to an empty string "" Var v13 = $.param ( [  "name", 2, 3 ] ); //  " Undefined=&undefined=&undefined= "



Reference: jquery param method http://www.studyofnet.com/news/933.html

This article is from the "Learning also leisure" blog, please be sure to keep this source http://studyofnet.blog.51cto.com/8142094/1695967

jquery param ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.