Skip to content

Instantly share code, notes, and snippets.

@daniyalzade
Created January 21, 2013 17:02
Show Gist options
  • Save daniyalzade/4587473 to your computer and use it in GitHub Desktop.
Save daniyalzade/4587473 to your computer and use it in GitHub Desktop.
Get URL parameter in javascript
function getURLParameter(name) {
var val = (RegExp('[?|&]' + name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1];
return val ? decodeURI(val) : val;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment