Advertisement
gundambison

datatable02-controllers

Aug 25th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. class Demo extends CI_Controller {
  6.  
  7.     public function __construct() {
  8.         parent::__CONSTRUCT();
  9.         $this->load->model('wilayah_m', 'region');
  10.     }
  11.  
  12.     public function index() {
  13.         $this->load->view('demo_datatable');
  14.     }
  15.  
  16.     function ajax_data() {
  17.         //if you use GET or other method.. just edit this
  18.         $params = $this->input->post();
  19.         $model = 'region';
  20.         $result = $this->$model->_datatables($params);
  21.  
  22. //erase what you think is not use
  23.         unset($result['raw']);
  24.         unset($result['params']);
  25.         unset($result['time']);        
  26.         //unset($result['sql']);
  27.         echo json_encode($result);
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement