Skip to content

Instantly share code, notes, and snippets.

@VincentVToscano
Created July 27, 2023 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VincentVToscano/982c4c4bf209823350251bd25e954909 to your computer and use it in GitHub Desktop.
Save VincentVToscano/982c4c4bf209823350251bd25e954909 to your computer and use it in GitHub Desktop.
Get URL Parameters
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