Skip to content

Instantly share code, notes, and snippets.

@kamilogorek
Created September 15, 2012 22:02
Show Gist options
  • Save kamilogorek/3730019 to your computer and use it in GitHub Desktop.
Save kamilogorek/3730019 to your computer and use it in GitHub Desktop.
Pull url parameters
var parameters = (function (src) {
var params = {}, qryStr = src.split('?')[1];
qryStr && $.each(qryStr.split('&'), function (i, p) {
ps = p.replace(/\/$/, '').split('=');
var k = ps[0].replace(/^\?/, '');
params[k] = ps[1] || true;
});
return params;
})(location.search);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment