How can I get query string values in JavaScript?

0 like 0 dislike

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) | 612 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,187 answers
40,796 users