Back to list
Views:   12.6K
Replies:  1
Archived

How to retrieve specific Name/Value pairs from Querystring in Javascript?

What is the best way to retrieve specific name/value pairs in Javascript from the Querystring?
For example if the url is "http://www.mycompany.com/customer/orders.aspx?id=1&name=john&address=main"
and I need the value for the id say.

Ideally I am looking for either a jQuery or else non-library solution (i.e. raw Javascript).

Thanks.
Bogusław Dobrogost, Apr 12, 2011
Reply 1
Thought of writing this down, but here a great deal of solutions...

http://stackoverflow.com/questions/901115/get-querystring-values-in-javascript

Also a jQuery plugin is available for the same.
http://plugins.jquery.com/project/query-object

It's simple as using below...
$.query.get('name'); // The site has the required docs..
Rajesh Pillai, Apr 16, 2011


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas