Created
July 27, 2023 17:35
-
-
Save VincentVToscano/982c4c4bf209823350251bd25e954909 to your computer and use it in GitHub Desktop.
Get URL Parameters
This file contains hidden or 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
function getURLParameters() { | |
let urlString = window.location.href; | |
let paramString = urlString.split('?')[1]; | |
let params_arr = paramString.split('&'); | |
for (let i = 0; i < params_arr.length; i++) { | |
let pair = params_arr[i].split('='); | |
console.log("Key is:" + pair[0]); | |
console.log("Value is:" + pair[1]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment