Skip to content

Instantly share code, notes, and snippets.

@agkovalev
Last active November 9, 2015 15:56
Show Gist options
  • Save agkovalev/3021b54ba495ff9bb729 to your computer and use it in GitHub Desktop.
Save agkovalev/3021b54ba495ff9bb729 to your computer and use it in GitHub Desktop.
Get URL Variables (JS)
Requests = {
QueryString : function(item){
var svalue = location.search.match(new RegExp("[\?\&]" + item + "=([^\&]*)(\&?)","i"));
return svalue ? svalue[1] : svalue;
}
}
//usage
Requests.QueryString("id");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment