Created
April 22, 2024 10:26
-
-
Save moloy666/d2724ad08ca5e4d97c87c4fc32c4fa8e to your computer and use it in GitHub Desktop.
get query parameter value from url in javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var urlString = "https://example.com/page?param1=value1¶m2=value2"; | |
var urlParams = new URLSearchParams(urlString); | |
var paramValue = urlParams.get('param1'); | |
console.log(paramValue); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment