Created
April 28, 2015 14:46
-
-
Save damirm/3df0e90e125a2d884ca0 to your computer and use it in GitHub Desktop.
$_GET
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 $_GET = (function () { | |
var getParams; | |
return function (param) { | |
if ( ! getParams ) { | |
getParams = decodeURIComponent(window.location.search.slice(1)) | |
.split('&') | |
.reduce(function _reduce (a, b) { | |
b = b.split('='); | |
a[b[0]] = b[1]; | |
return a; | |
}, {}); | |
} | |
return getParams[param]; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment