Created
July 19, 2012 13:18
-
-
Save blake-simpson/3143863 to your computer and use it in GitHub Desktop.
Javascript module that returns current URL params ($.params)
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
(function(){ | |
findURLParams = function() { | |
var params = {}; | |
location.search.replace( | |
/([^?=&]+)(=([^&]*))?/g, | |
function (match, key, full, value) { | |
params[key] = decodeURIComponent(value); | |
} | |
); | |
return params; | |
} | |
$.params = findURLParams(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment