i'm using laravel 5.8 there is 2 days when i was doing some search and how to retrieve and show data in datatables but without result
//this is code of a part of my controller file
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Datatables;
use Auth;
use App\User;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$user =Datatables::of(User::query())->make(true);
return view('manage_users.index', ['users' => $user]);
}
/**
and the code of a html page and script
<script src="//code.jquery.com/jquery-1.12.3.js"></script>
<script src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script
src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet"
href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css">
<link href="styles/vendor/AdminLTE/css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<link href="bower_components/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet" type="text/css" />
<table id="table" class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th class="th-sm">ID</th>
<th class="th-sm">Name</th>
<th class="th-sm">Email</th>
<th class="th-sm">Type user</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th>Id
</th>
<th>Name
</th>
<th>Email
</th>
<th>Type user
</th>
</tr>
</tfoot>
</table>
<script>
$(document).ready(function() {
$('#table').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "../server_side/scripts/server_processing.php"
} );
} );
</script>
i get empty table whith ajax error like this: DataTables warning: table id=table - Ajax error. For more information about this error, please see http://datatables.net/tn/7