Home How can I get query string values in JavaScript?
Reply: 0

How can I get query string values in JavaScript?

user10902 Published in September 19, 2018, 3:25 am

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?


locked by animuson Jul 25 '14 at 19:35

This question's answers are a collaborative effort: if you see something that can be improved, just edit the answer to improve it! No additional answers can be added here

  • I use the plugin getUrlParam described in jQuery-Plugin – getUrlParam (version 2). – coma May 23 '09 at 8:19
  • 69
    A plain javascript solution without RegEx: css-tricks.com/snippets/javascript/get-url-variables – Lorenzo Polidori Oct 29 '12 at 14:50
  • 6
    Although the top solution to the question deserves its popularity because of its excellent observation that jQuery is not needed, its method of creating new regular expressions and re-parsing the query string for every parameter desired is extremely inefficient. Far more efficient (and versatile) solutions have been in existence for a long time, for example within this article reprinted here: htmlgoodies.com/beyond/javascript/article.php/11877_3755006_3/… – Joseph Myers May 14 '13 at 6:00
  • 1
    possible duplicate of JavaScript query string – user456814 Jul 31 '13 at 23:09
  • 4
    Joseph, the "excellent observation that jQuery is not needed"? Of course it's not needed. Everything jQuery does, it does using JavaScript. People don't use jQuery because it does stuff that JavaScript can't do. The point of jQuery is convenience. – Vladimir Kornea May 30 '14 at 1:12

73 Answers 73

active oldest votes
1 2 3 next
up vote 7089 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.495651 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO