dojo/io-query

Summary

This module defines query string processing functions.

See the dojo/io-query reference documentation for more information.

Methods

objectToQuery(map)

Defined by dojo/io-query

takes a name/value mapping object and returns a string representing a URL-encoded version of that object.

Parameter Type Description
map Object

Returns: undefined

Examples

Example 1

this object:

{
    blah: "blah",
    multi: [
        "thud",
        "thonk"
    ]
};

yields the following query string:

"blah=blah&multi=thud&multi=thonk"

queryToObject(str)

Defined by dojo/io-query

Create an object representing a de-serialized query section of a URL. Query keys with multiple values are returned in an array.

Parameter Type Description
str String

Returns: object

Examples

Example 1

This string:

"foo=bar&foo=baz&thinger=%20spaces%20=blah&zonk=blarg&"

results in this object structure:

{
    foo: [ "bar", "baz" ],
    thinger: " spaces =blah",
    zonk: "blarg"
}

Note that spaces and other urlencoded entities are correctly handled.

© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/io-query.html