[英]How to pass Jquery value to code behind in asp.net
$("#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);
});
該代碼多次返回高度,寬度,長度和重量(相對於轉換)。
我想將所有這些值傳遞給文件后面的代碼,然后將所有值傳遞給這個包。
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....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.