js url 参数 转换成 json 对象数据
some=params&over=here => {"some":"params","over":"here"}
var params = getUrlVars('some=params&over=here'); console.log(params); function getUrlVars(url) { var hash; var myJson = {}; var hashes = url.slice(url.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); myJson[hash[0]] = hash[1]; } return myJson; }