Elegant way of retrieving query string parameter.
- by Wondering
Hi All,
I am retrieving one query string parameter, and for that my code is
<a href="Default2.aspx?Id=1&status=pending&year=2010">Click me</a>
Now I want to retrieve "status=pending" and for that I am doing
var qString = window.location.search.substring(1);
var Keys = qString .split('&');
alert(Keys[1]);
This works fine, but I am hard-coding [1] here. is there any elegent way of doing this without hard-coding?