Sunday 19 May 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...