load->model('pagination/DrugAndDevices_model', 'model'); } function getLists() { $data = $row = array(); // Fetch member's records $witData = $this->model->getRows($_POST); $i = $_POST['start']; foreach ($witData as $index => $row) { $data[] = array($index+1, $row->code, $row->name,$this->lang->line($row->type), $this->lang->line($row->on_prescription ? 'Oui' : 'Non'), ' '); } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->model->countAll($_POST), "recordsFiltered" => $this->model->countFiltered($_POST), "data" => $data, ); // Output to JSON format echo json_encode($output); } }