gpt4 book ai didi

javascript - 更改查询字符串参数

转载 作者:行者123 更新时间:2023-12-02 18:47:01 25 4
gpt4 key购买 nike

应该怎样?

var text = $(this).siblings("[type=text]").val();
document.location = "Default.aspx" + "?id=" + text + "&type=" + query;

最佳答案

属性的名称是window.location,而不是document.location。此外,您可能希望使用 encodeURIComponent 转义其中一个(或两个)值。

<b>window</b>.location = "Default.aspx" +
"?id=" + <b>encodeURIComponent(</b>text<b>)</b> +
"&type=" + <b>encodeURIComponent(</b>query<b>)</b>;

关于javascript - 更改查询字符串参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16263247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com