gpt4 book ai didi

带有 jQ​​uery UI Sortable 序列化方法的 ASP.NET Web 服务示例

转载 作者:行者123 更新时间:2023-12-04 06:38:59 25 4
gpt4 key购买 nike

我正在构建可排序的 jQuery UI,以使用序列化和 ASP.NET Web 服务在数据库中存储订单。

我知道如何在 php 中做到这一点,但我不知道如何在 ASP.NET 中做到这一点......我尝试使用谷歌搜索但收效甚微。

   $('#mylist').sortable({
handle: ".handle",
axis: "y",
update: function () {
var order = $(this).sortable('serialize');
alert(order);
}
});

给我查询字符串 item[]=2&item[]=1&item[]=3&item[]=4
我需要将它传递给 Web 服务,并将新订单存储到数据库中。

最佳答案

我认为是执行下面的代码

$('#mylist').sortable({
handle: ".handle",
axis: "y",
update: function () {
var order = $(this).sortable('toArray');
}
});

它按照它们出现的顺序给出了 id 数组。现在,当您保存并取回此数组时,请执行此操作。
//伪代码
for each id in the arrayList
GetElementByid(id); attach to parent UL

最后,如果你看到,列表将按照以前的状态排列

关于带有 jQ​​uery UI Sortable 序列化方法的 ASP.NET Web 服务示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4512796/

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