Skip to content

Instantly share code, notes, and snippets.

@itsPG
Created January 4, 2016 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsPG/70a28491f6e778e9b229 to your computer and use it in GitHub Desktop.
Save itsPG/70a28491f6e778e9b229 to your computer and use it in GitHub Desktop.
urlDecode.js
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