Search code examples
yuiyui3

YUI3 equivalent to getQueryStringParameter for obtaining query string params


Can somebody please tell me what the equivalent to YUI2's and the YUI3 deprecated

Y.History.getQueryStringParameter('paramName'); 

is in the latest YUI3.

Thank you!


Solution

  • Y.QueryString.parse should do the trick.

    (it's not documented, but it's in the source: http://yuilibrary.com/yui/docs/api/files/querystring_js_querystring-parse-simple.js.html#l7 )

    you just pass it the querystring (which you can get from window.location.search, excluding the '?' char), and it gives you an object back, with all the key-value pairs.