After setting a new data-order_item to my divs, I'm trying to post an array to my controller with the data_order and the data_id:
var counter = 0;
item_cnt = new Array();
cnt.find('.item_incompleted').each(function(){
counter += 1;
$(this).attr("data-order_item", counter);
item_element = new Array();
item_element['order'] = $(this).attr("data-order_item");
item_element['item_id'] = $(this).attr("data-item_id");
item_cnt.push(item_element);
});
url = cnt.attr('data-order_route');
$.ajax({
type: "POST",
url: url,
data: item_cnt,
});
By console logging item_cnt the array is fine, however, by var_dumping $_POST in the controller the array is empty and it seems like it's not posting the array at all.