Skip to content

Instantly share code, notes, and snippets.

@joshnesbitt
Created December 22, 2010 12:12
Show Gist options
  • Select an option

  • Save joshnesbitt/751438 to your computer and use it in GitHub Desktop.

Select an option

Save joshnesbitt/751438 to your computer and use it in GitHub Desktop.
function getParam(key)
{
var regex, values;
regex = new RegExp("[\\?&]" + key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]") + "=([^&]*)", "i");
values = regex.exec(unescape(window.location.href));
return (values == null) ? "" : values[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment