Skip to content

Instantly share code, notes, and snippets.

@codingcarpenter
Last active March 10, 2016 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codingcarpenter/f98c4210e2e542e7b759 to your computer and use it in GitHub Desktop.
Save codingcarpenter/f98c4210e2e542e7b759 to your computer and use it in GitHub Desktop.
Gets named parameter from URL
Requests = {
QueryString: function(item) {
var svalue = location.search.match(new RegExp('[\?\&]' + 'searchTerm' + '=([^\&]*)(\&?)','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