I am using jquery ui sortable for my codeigniter website but when i am sorting data it will give me empty array in console. please check and let me know my mistake.
<script>
$(document).ready( function() {
$("#sortme tbody").sortable({
update : function (event, ui) {
// console.log(ui);
serial = $('#sortme tbody td .ds').sortable();
console.log(serial);
$.ajax({
url: "<?=base_url().'admin/pages/save_order'?>",
type: "post",
data: serial,
success: function(response,data){
console.log(response);
},
error: function(){
alert("theres an error with AJAX");
}
});
}
});
});
</script>
here controller
public function save_order()
{
print_r($_POST);
exit;
$menu = $_POST['menu'];
for ($i = 0; $i < count($menu); $i++)
{
echo $menu[$i];
}
}
Use