Util Class
General utilities
Item Index
Methods
Methods
buildQueryString
(
String
-
Hash
URL encode some data, for POSTing or use in a GET querystring. Supports a single level of arrays or objects in the data hash. These will be formatted as a PHP array.
Parameters:
-
Hash
ObjectHash of data
Returns:
String:
URL encoded querystring
Example:
var stuff =
{
hello: 'world',
foo: 'bar',
arrayTest: [1, 2, 3],
objectTest:
{
one: 'two',
three: 'four'
}
};
Util.buildQueryString(stuff) // returns hello=world&foo=bar&arrayTest[]=1&arrayTest[]=2&objectTest[one]=two&objectTest[three]=four
extend
(
Object
-
destination
-
source
Add all elements from source to destination and return the modified destination (for chaining)
Parameters:
-
destination
ObjectObject to copy properties to
-
source
ObjectObject to copy properties from
Returns:
Object:
An object with all the combined properties
Example:
var first = { hello: 'world' };
var second = { foo: 'bar' };
var result = Util.extend(first, second);
// first and result now both contain { hello: 'world', foo: 'bar'}