Skip to content

Instantly share code, notes, and snippets.

@taybenlor
Created August 29, 2010 08:53
Show Gist options
  • Save taybenlor/556117 to your computer and use it in GitHub Desktop.
Save taybenlor/556117 to your computer and use it in GitHub Desktop.
function getArgs(){
var url = window.location.href;
var qparts = url.split("?");
if (qparts.length == 1){
return {};
}
var query = qparts[1];
var vars = $A(query.split("&"));
var args = {}
vars.each(function(parts){
parts = parts.split("=");
args[parts[0]] = unescape(parts[1]).replace(/\+/g," "); //unescape and turn +'s into spaces
});
return args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment