Skip to content

Instantly share code, notes, and snippets.

@anshuraj
Created July 10, 2018 10:05
Show Gist options
  • Save anshuraj/1211a003040fc7b83621bd67b6a42c86 to your computer and use it in GitHub Desktop.
Save anshuraj/1211a003040fc7b83621bd67b6a42c86 to your computer and use it in GitHub Desktop.
const getQueryVariable = variable => {
const query = window.location.search.substring(1);
const params = query.split("&");
for (let i=0;i<params.length;i++) {
const pair = params[i].split("=");
if(pair[0] == variable) {
return pair[1];
}
}
return false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment