Edit this page

up.Params up.Params.prototype.get(name)
Class method

This feature is experimental. It may be changed or removed in a future version.

Returns the first param value with the given name from the given params.

Returns undefined if no param value with that name is set.

If the name denotes an array field (e.g. foo[]), all param values with the given name are returned as an array. If no param value with that array name is set, an empty array is returned.

To always return a single value use up.Params#getFirst() instead. To always return an array of values use up.Params#getAll() instead.

Example

var params = new up.Params({ foo: 'fooValue', bar: 'barValue' })
var params = new up.Params([
  { name: 'foo', value: 'fooValue' }
  { name: 'bar[]', value: 'barValue1' }
  { name: 'bar[]', value: 'barValue2' })
]})

var foo = params.get('foo')
// foo is now 'fooValue'

var bar = params.get('bar')
// bar is now ['barValue1', 'barValue2']

Parameters

name string