0

我有这个js代码

$("#sortable").sortable({
axis: 'y',
handle: '.fancybox',
update: function() {

    var order = $('#sortable').sortable('serialize');
    $("#sortable").load("inc/ajax/sortable/update2.php?"+order);
    alert(order);


}
});

我用 php 填充列表:

foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $result) 
            {

                $_SESSION['img'][]=$result['id_imag'];
                $img[]="
                <div class='highlight-3' width='100%'>
                <li id='".$result['id_imag']."'>



                            <a class='fancybox' href='".$result['den_img']."' data-fancybox-group='gallery' title='Reian Imob'  >
                            <img src='".$result['den_img']."'  id='".$result['id_imag']."' ></a>
                            <a href='#' id='".$result['id_imag']."' class='del' onclick='delete_imag_mod(this);' >Delete</a>



                </li>
                </div>";
            }

的HTML:

 <ul class="gallery" id="sortable" style="background:#FCFCFC; width:100%">
                     <?php

                     $images=$db->select_images ($_POST['vid']);
                     if($nr_imag>0) {
                     foreach($images as $val) 

                            {
                            echo $val;  
                            }   
                     }
                     ?>
                       </ul>

问题是: var order 没有得到值。我该如何解决?

4

1 回答 1

0

您的html代码应如下所示:

<ul id="sortable">
<li id="li_first"> // here undercsore is mandatory  
    <div>some text</div>
</li>
<li id="li_second"> // here undercsore is mandatory
    <div>some text</div>
</li>
</ul>

有关更多信息,请查看此链接:http ://api.jqueryui.com/sortable/#method-serialize

于 2013-10-14T17:50:34.260 回答