I use CodeIgniter framework and use this function to sort my news-posts
$(".news-list").sortable({
opacity: 0.6,
cursor: 'move',
update: function(event, ui) {
var order = $(this).sortable("serialize"); //console.log(order);
$.ajax({
type: 'POST',
url: "<?php echo base_url();?>news/sort_posts/",
data: ( order ),
success: function(data){ console.log('Success'); },
error: function(data){ console.log("Fail"); }
})
},
distance: 15
});
Allthough I have to disable CSRF in config.php
to make it work, since the CSRF-cookie is not included.
So, with the order-array I want to send:
<?php echo $this->security->get_csrf_token_name() ?> : '<?php echo $this->security->get_csrf_hash() ?>'
How is this done?