I am using http://johnny.imtqy.com/jquery-sortable/
I can't figure out how to send serialized data?
My html
<ul>
<li data-id="1">Item 1</li>
<li data-id="2">
Item 2
<ul>
<li data-id="4">Item 4</li>
<li data-id="5">Item 5</li>
</ul>
</li>
<li data-id="3">Item 3</li>
</ul>
Js
$(function () {
$("ul#menuList").sortable({
handle: 'i.icon-move',
itemSelector: 'li',
placeholder: '<li class="placeholder"/>',
onDrop: function (item, container, _super)
{
$.ajax({
url: "ajax_action.php",
type: "post",
data: dataToSend,
cache: false,
dataType: "json",
success: function()
{}
});
}
});
});
I tried as described in this question , but it does not work with ul-> li
I need to get an array
[0] => Array
(
[id] => 1
)
[1] => Array
(
[id] => 2
[children] => Array
(
[0] => Array
(
[id] => 4
)
[1] => Array
(
[id] => 5
)
)
)
[2] => Array
(
[id] => 3
)
I would be grateful for your help.
source
share