html
<ul id="user-stream-list" class="user-stream-list ui-sortable">
<li data-id="36" data-oid="0" class="feed" style="position: relative; left: 0px; top: 0px;"><span class="cat-title" data-title="36">Tech Crunch<span class="edit-title" style="right: 35px;">rename</span><span class="delete-title">×</span></span>
<ul class="ui-sortable">
</ul>
</li>
<li data-id="37" data-oid="1" class="feed" style="position: relative; left: 0px; top: 0px;"><span class="cat-title" data-title="37">Apple<span class="edit-title">rename</span></span>
<ul class="ui-sortable">
<li class="feed sub"><a data-uid="18" data-fid="11" href="http://appleinsider.com/appleinsider.rss"><img src="https://www.google.com/s2/favicons?domain=appleinsider.com" class="favicon"><span class="title">AppleInsider - Frontpage News</span><span class="options"><span data-fid="11" class="addcat">+</span><span class="delete">×</span></span></a></li>
</ul>
</li>
</ul>
jQuery
$( "#user-stream-list" ).sortable({
update : function () {
var order = $('#user-stream-list').sortable('serialize');
console.log(order);
//$("#info").load("process-sortable.php?"+order);
}
});
D B
id uid oid cname
20 36 0 Tech Crunch
21 37 1 Apple
当我重新排列以下我的 console.log() 返回时(an empty string)
,我不知道为什么它没有显示任何内容。jsFiddle
我试图传递 data-id 和 data-oid 以便在 php 中我可以将两者绑定起来处理到我的数据库。