Skip to content

Instantly share code, notes, and snippets.

@rkmaier
Created April 5, 2012 08:45
Show Gist options
  • Save rkmaier/2309260 to your computer and use it in GitHub Desktop.
Save rkmaier/2309260 to your computer and use it in GitHub Desktop.
JQUERY::GET GETVARIABLES
function getQuerystring(key, default_)
{
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment