gpt4 book ai didi

javascript - 如何将 Jquery 值传递给 asp.net 中的代码隐藏

转载 作者:行者123 更新时间:2023-11-28 07:33:35 25 4
gpt4 key购买 nike

 $("#getButtonValue").click(function () {
var msg = '';
for (i = 1; i < counter; i++) {
msg += "\n Width #" + i + " : " + $('#txtWidth' + i).val();
msg += "\n Height #" + i + " : " + $('#txtHeight' + i).val();
msg += "\n Length #" + i + " : " + $('#txtLength' + i).val();
msg += "\n Weight #" + i + " : " + $('#txtWeight' + i).val();
}
alert(msg);
});

此代码多次返回高度、宽度、长度和重量(相对于计数器)。

enter image description here

我想将所有这些值传递给文件后面的代码。并将所有值传递给这个包。

                qurystr += "&packages[1][width]=" ";
qurystr += "&packages[1][height]="";
qurystr += "&packages[1][length]="";
qurystr += "&packages[1][weight]="";

请帮忙。谢谢

最佳答案

您可以使用隐藏字段将列表保存为逗号分隔值

<asp:HiddenField runat="server" id="hdf" />

在 JS 中

$('<%#hdf.CliendID%>').value="1,2,3,4,5,6,7,8,9";

width,height,length,width,height,length....

关于javascript - 如何将 Jquery 值传递给 asp.net 中的代码隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28849454/

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