ExtJs encode & decode & url

来源:互联网 发布:c语言从入门到精通pdf 编辑:程序博客网 时间:2024/05/17 12:52
encode( o ) : String

Shorthand for Ext.util.JSON.encode

Available since: 1.1.0

Parameters

  • o : Mixed

    The variable to encode

Returns

  • String

    The JSON string

decode( json, [safe] ) : Object

Shorthand for Ext.util.JSON.decode

Available since: 1.1.0

Parameters

  • json : String

    The JSON string

  • safe : Boolean (optional)

    Whether to return null or throw an exception if the JSON is invalid.

Returns

  • Object

    The resulting object

urlDecode( string, [overwrite] ) : Object

Takes an encoded URL and and converts it to an object. Example:

Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", bar: "2"}Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2", "3", "4"]}

Available since: 1.1.0

Parameters

  • string : String
  • overwrite : Boolean (optional)

    Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).

Returns

  • Object

    A literal with members


urlEncode( o, [pre] ) : String

Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2". Optionally, property values can be arrays, instead of keys and the resulting string that's returned will contain a name/value pair for each array value.

Available since: 1.1.0

Parameters

  • o : Object
  • pre : String (optional)

    A prefix to add to the url encoded string

Returns

  • String

0 0
原创粉丝点击