Javascript获取GET参数
程序员文章站
2022-06-19 10:33:53
链接: https://example.com?id=1&type=2 ......
function getqueryvariable() { let query = window.location.search.substring(1); let key_values = query.split("&"); let params = {}; key_values.map(key_val => { let key_val_arr = key_val.split("="); params[key_val_arr[0]] = key_val_arr[1]; }); return params; }
链接: