79335913

Date: 2025-01-07 12:02:06
Score: 1
Natty:
Report link

I experienced the same error. The problem is the formatting of the JSON response from the server. DataTables looks for the keyword 'data' in your response and you currently have none.

Change your server side code from:

 function getUsers(){
   $this->db->select('id,username');
   $query = $this->db->get('user');
   $data = $query->result();
   echo json_encode($data); 
 }

To:

 function getUsers(){
   $this->db->select('id,username');
   $query = $this->db->get('user');
   $data = $query->result();
   echo json_encode(array('data'=>$data)); 
 }

For more information on this and other common DataTable errors, you can visit this link -> jQuery DataTables: Common JavaScript console errors

Reasons:
  • Blacklisted phrase (1): this link
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Simile Mhlanga