я использую laravel 5.8, есть 2 дня, когда я проводил поиск и извлекал и отображал данные в таблицах данных, но без результата
// это код части моего файла контроллера
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]);
}
/**
и код html-страницы и сценария
<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>
я получаю пустую таблицу с ошибкой ajax, например: Предупреждение DataTables: table id = table - ошибка Ajax.Для получения дополнительной информации об этой ошибке, см. http://datatables.net/tn/7