Created
September 15, 2012 22:02
-
-
Save kamilogorek/3730019 to your computer and use it in GitHub Desktop.
Pull url parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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