Created
January 4, 2016 06:30
-
-
Save itsPG/70a28491f6e778e9b229 to your computer and use it in GitHub Desktop.
urlDecode.js
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 urlDecode(query) { | |
var queryString = query || window.location.search.slice(1), | |
decodeFn = window.decodeURIComponent, | |
options = decodeFn(queryString).split('&'), | |
pair, i, ret = {}; | |
for (i = 0; i < options.length; ++i) { | |
pair = options[i].split('='); | |
ret[pair[0]] = pair[1]; | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment