Avatar of tmitch1968
tmitch1968
 asked on

In javascript, what is the easiest way to get a parameter from the url?

Hello,

Isn't there a simple way to get a parameter from the url within javascript?  For example, is there a way to get the value of param1 from http://somesite.com/somepage.php?param1=asdf

Thanks in advance
JavaScriptHTML

Avatar of undefined
Last Comment
tmitch1968

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rob

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Rob

http://www.w3schools.com/jsref/prop_loc_search.asp shows how to retrieve the querystring.

you could use this plugin https://github.sindresorhus/query-string

they all essentially use regular expressions to extract the key value pairs into an object
tmitch1968

ASKER
Awesome - thanks!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23