我在列表中使用了列表,我打算使用 jquery 将 id 发送到另一个 php 文件(updateDB.php)。
我尝试序列化列表但无法获取数据。我不确定我是否做对了,尝试环顾每个地方,但无法弄清楚代码有什么问题。
<ul>
<li id="recordsArray_<?some number?>"><?php echo content?>`
    <ul>
        <?php
        while (some condition) {
            ?>
            <div>
            <li id="subArray_<another number?>"><?php echo content?></li>
            </div>
            <?php
            //conditions - increment within the loop
        }
        ?>
    </ul>
 </li></ul>
jquery代码是这样的,
$(document).ready(function() {
    $(function() {
        $("#contentLeft ul").sortable({opacity: 0.6, cursor: 'move', update: function() {
            var order = $(this).sortable('serialize') + '&action=updateMenuListings';
            $.post("updateDB.php", order, function(theResponse) {
                $("#contentRight").html(theResponse);
            });
        }});
    });
    $(function() {
        $("#contentLeft ul li ul").sortable({opacity: 0.6, cursor: 'move', update: function() {
            var order = $(this).sortable('serialize') + '&action=updateSubListings';
            $.post("updateDB.php", order, function(theResponse) {
                $("#contentRight").html(theResponse);
            });
        }});
    });
});
id 的 contentLeft 只是列表之前的 id。我打算使它可拖动,因此使用可排序。
在调试时,我无法获取变量“order”中列表的任何 ID。
请务必检查代码并提供帮助。
谢谢