Skip to content

Instantly share code, notes, and snippets.

@joshbroton
Created November 17, 2013 15:16
Show Gist options
  • Save joshbroton/7514529 to your computer and use it in GitHub Desktop.
Save joshbroton/7514529 to your computer and use it in GitHub Desktop.
Get URL Parameter by Name
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)')
.exec(window.location.search);
return match ?
decodeURIComponent(match[1].replace(/\+/g, ' '))
: null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment