Last active
August 29, 2015 14:23
-
-
Save thomasJang/ae46c01efb2ae13e402c to your computer and use it in GitHub Desktop.
window.location parameter convert to JSON
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
// window.location parameter convert to JSON | |
var | |
param = {}, | |
parameter = window.location.search.replace(/^\?/, '').split(/&/g), | |
i = parameter.length, pidx; | |
while(i--){ | |
param[ parameter[i].substr(0, pidx = parameter[i].indexOf("=")) ] = | |
parameter[i].substr( pidx + 1 ); | |
} | |
console.log(param); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/axisj/axisj