Monday, 19 February 2018

Using the GET parameter of a URL in JavaScript




If I am on a page such as




http://somesite.com/somepage.php?param1=asdf



In the JavaScript of that page, I would like to set a variable to the value of the parameter in the GET part of the URL.



So in JavaScript:







What would "..." be?


Answer



Here's some sample code for that.






No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...