Skip to content

Instantly share code, notes, and snippets.

@kgsnipes
Created March 16, 2012 14:54
Show Gist options
  • Save kgsnipes/2050415 to your computer and use it in GitHub Desktop.
Save kgsnipes/2050415 to your computer and use it in GitHub Desktop.
retrieve url parameters in javascript
$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (!results) { return 0; }
return results[1] || 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment