var rows_selected = [];
var rowId = data[0]; // conten [24,25,26,27 etc]
var namaFile = data[4]; // content [foto1.JPG, foto2.JPG, foto3.JPG, foto4.JPG ]
//If checkbox is checked and row ID is not in list of selected row IDs
rows_selected.push(rowId,namaFile);
var dataId=[];
$.each(rows_selected, function(index, rowId, namaFile){
dataId.push(rowId,namaFile);
});
in ajax i sent dataId to controller
$.ajax({
data: {"iddata": "[{"+dataId+"}]"},
});
but in controller iddata receive just one array like this 24,6a5236ee48848e648553a35d64c4f64dJPG,25,a31ea31db31483506fbd95e463d4c8ffJPG,26,042fd1eee499e5bb9c93853c0299b42eJPG,27,e243845bcc0447324d449e37b271c9ebJPG,28,8f331fa2a713f5268ab71698a65185b6JPG
some code in controller
$iddata=array();
$iddata=array($_GET['iddata']);
$a=explode(",", $iddata[0]);
$b=preg_replace('/[^A-Za-z0-9\-]/', '', $a);
$jumlahdata=count($b)/2;
for($i=0;$i<$jumlahdata;$i++)
{
//delete on database
$data=array('id_perjal'=>$b[$i]);
$this->M_perjal_terpasang->Delete_Foto($data);
//and i want deleting foto with unlink
unlink("assets/images/uploads/"$b[$i]);
}