I have dataId
from checkbox values and I'm sending it using a GET AJAX request:
dataId = 1, 2, 16, 15, 17, 3, 14, 5, 9, 11;
URI = "<?php echo site_url('Terpasang/Update_Kebutuhan_ke_Terpasang')?>";
$.ajax({
url : URI,
type: "GET",
data: { "iddata": [dataId] },
dataType: "JSON",
});
In controller I am passing this data with code:
$iddata = array($_GET['iddata']);
$Countdata = count($iddata);
for($i = 0; $i <= $Countdata; $i++)
{
$data = array('id_perjal'=>$iddata[$i]); // this code can't generate id one by one like i wanna : 1, next 2, next 16 etc
$this->M_perjal_terpasang->save($data);
}
echo json_encode(array("status" => TRUE));