function getRequestParams(){var params = {}; var href = location.href; var index = href.indexOf('?'); if(index !== -1){ href = href.substring(index + 1); var arr = href.split("&"); var temp; for(var i = 0; i < arr.length; i++){ temp = arr[i].split("="); params[temp[0]]=temp[1] } } return params; }
function getRequestParams(){ let params = {}; let href = location.href; var index = href.indexOf('?'); if(index !== -1){ href = href.substring(index + 1); let arr = href.split("&"); arr.forEach(item => { let temp = item.split("="); params[a[0]]=a[1]; }) } return params; }