获取请求后面参数
程序员文章站
2022-03-10 11:58:37
...
function getSearchObj() { var url = getSearch(); var searchObj = {}; if (url) { // 去掉?号 url = url.substr(1); if (url.length > 0) { var arr = url.split("&"); for (var i = 0; i 0 && keyVal.indexOf("=") > 0) { var keyValArr = keyVal.split("="); var key = keyValArr[0]; var val = keyValArr[1]; searchObj[key] = val; } } } } return searchObj; }