JSLite - handling URLs


If you have any questions, you are welcome to communicate in these places, and you are welcome to join the JSLite.io organization team for joint development!

$.getUrlParam

Get the value of the url parameter.

//[URL] = http://blog.pc175.com/?param=2
$.getUrlParam("param") //⇒ 2

$.param

Serialize the form element array or object. If shallow is set to true, nested objects will not be serialized, and nested array values ​​will not have parentheses around their keys.
$.param(object, [shallow]) ⇒ string
$.param(array) ⇒ string

$.param({
    foo: {one: 1,two: 2 }
})  //⇒ "foo[one]=1&foo[two]=2"

$.param({
    ids:["a1","b2","c3"],
    c:{g:23,e:[567]},
    a:3
},true) //⇒ ids=a1&&ids=b2&&ids=c3&&c=[object Object]&a=3

$.param({
    ids:["a1","b2","c3"],
    c:{g:23,e:[567]},
    a:3
}) //⇒ ids[]=a1&&ids[]=b2&&ids[]=c3&&c[g]=23&&c[e]=567&&a=3

$.param([1,2,3]) //⇒ 0=1&&1=2&&2=3

$.param({
    ids:[1,2,3] 
})  //=> "ids[]=1&ids[]=2&ids[]=3"