Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ca5f9f3f63
Fetching contributors…

Cannot retrieve contributors at this time

110 lines (78 sloc) 3.212 kb



Helper function for converting a JavaScript object into a properly encoded query string.


This function is one of many helpers used by the dojo Xhr subsystem for handling AJAX style requests. This particular function takes a JavaScript object and converts it to a query string suitable to append onto a URI. This function is useful in constructing URIs quickly and cleanly, with the proper special character encoding. The resultant query string can be converted back to a JavaScript object by the function :ref:`dojo.queryToObject <dojo/queryToObject>`

Since Dojo 1.7, dojo.objectToQuery is exposed via the objectToQuery method of the dojo/io-query module. An alias is kept in dojo/_base/xhr for backward-compatibility.


Usage is simple and straightforward, you pass the object you wish converted to a query string and the function will return the query string.

Dojo 1.7+ (AMD)

Dojo < 1.7


Example 1: Using dojo.objectToQuery to create a query string and assign it to a URI

See also

Jump to Line
Something went wrong with that request. Please try again.