<a href="{{ payment.approve}}" class="pointer"><i class="fa fa-ban color-red"></i> Approve Payment</a><a href="{{ payment.reject}}" class="pointer"><i class="fa fa-ban color-red"></i> Reject Payment</a><script> if (filterpayment) { url += '&filterpayment=' + encodeURIComponent(filterpayment); }</script>使用过滤器后”我的网址将是这样的http://localhost/index.php?route=sales/filterpayment&user_token=XXXXXX&filterpayment=2&page=2对于第 2 页是“分页”我想要的是,在执行操作(例如单击批准)后,如何在不删除“page2”的情况下重置它单击后我想要的是:批准http://localhost/index.php?route=sales/filterpayment&user_token=XXXXXX&page=2我试过的:url = 'index.php?route=sales/filterpayment&user_token={{ user_token }}';location = url;但它会直接重置 URL 中的“page2”并变成这个http://localhost/index.php?route=sales/filterpayment&user_token=XXXXXX
1 回答
呼如林
TA贡献1798条经验 获得超3个赞
使用搜索参数
let url = new URL("http://localhost/index.php?route=sales/filterpayment&user_token=XXXXXX&page=2")
let filterpayment = 2;
if (filterpayment) {
url.searchParams.set("filterpayment",encodeURIComponent(filterpayment));
}
console.log(url)
filterpayment = 0;
if (filterpayment) {
url.searchParams.set("filterpayment",encodeURIComponent(filterpayment));
}
else {
url.searchParams.delete("filterpayment");
}
console.log(url)
- 1 回答
- 0 关注
- 201 浏览
添加回答
举报
0/150
提交
取消