Skip to content

Instantly share code, notes, and snippets.

@wmelton
Created October 29, 2015 18:40
Show Gist options
  • Save wmelton/aa58e9fece2bde9244bd to your computer and use it in GitHub Desktop.
Save wmelton/aa58e9fece2bde9244bd to your computer and use it in GitHub Desktop.
JS to get URL Parameters
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
}
myvar = getURLParameter('myvar');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment