Skip to content

Instantly share code, notes, and snippets.

@anunay
Last active November 20, 2019 03:49
Show Gist options
  • Save anunay/5308320 to your computer and use it in GitHub Desktop.
Save anunay/5308320 to your computer and use it in GitHub Desktop.
Javascript: Query String Fetcher, URL Params, URL Parameters
function urlParam(name, w){
w = w || window;
var rx = new RegExp('[\&|\?]'+name+'=([^\&\#]+)');
var val = w.document.URL.match(rx);
return !val ? '':val[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment