location.href=“1.php?a[]=”+json
location.href = “1.php?a=” + escape(JSON.stringify(json)); 支持多维
obj = {
ids: this.selectTable,
list_ids: this.list_ids
};
var path = api.con.expot; //请求获取后端地址
var query = "";url
var ids = "";//需要传递的id数组
Object.keys(obj).forEach(v => {
query = query + v + "=" + obj[v] + "&";
});
if (type == 1) {
//批量
this.selectTable.forEach(item => {
ids = ids + "ids[]=" + item + "&";
});
window.location.href = path + "?" + ids;
} else {
window.location.href = path + "?" + query;
}
//拼接后的url
http://www.baidu.com?ids[]=111&ids[]=222&