How can I get query string values in JavaScript?

0 like 0 dislike
15 views

Is there a plugin-less way of retrieving query string values via jQuery (or without)?

If so, how? If not, is there a plugin which can do so?

by (550 points) | 15 views

1 Answer

0 like 0 dislike

Some of the solutions posted here are inefficient. Repeating the regular expression search every time the script needs to access a parameter is completely unnecessary, one single function to split up the parameters into an associative-array style object is enough. If you're not working with the HTML 5 History API, this is only necessary once per page load. The other suggestions here also fail to decode the URL correctly.

by (1.2k points)

Related questions

110,608 questions
257,186 answers
0 comments
1,117 users