(09-21-2015, 10:38 PM)salain Wrote: Hi,
You need to change your controller to this to work:
PHP Code:
public function index() {
$this->data['datatables'] = true;
$this->data['data_url'] = 'admin/get_post_datatables';
// load view
$this->load->view('admin/posts/index', $this->data);
}
Public function get_post_datatables(){
echo $this->post_model->get_datatable();
}
Thank you for your reply. I 've done some changes on my code so you can review it
PHP Code:
**
* List all posts
*/
public function index() {
$this->data['datatables'] = true;
$this->data['data_url'] = 'admin/posts/datatables_ajax';
// $this->data['posts'] = $this->post_model->get_datatable();
// dump($this->data['pages']);
// load view
$this->load->view('admin/pages/index', $this->data);
}
public function datatables_ajax() {
$this->output->enable_profiler(false);
$this->data['posts'] = $this->post_model->get_datatable();
// echo $this->data['posts'];
}
I've put it on a separate function, as you said before but still same thing