Yajra Datatables Package for Laravel deosnt work properly with laravel 5.2 -


i have installed yajra/laravel-datatables-oracle "~6.0" package supporting server-side datatables in laravel 5.2 mysql database. i'm trying display datatable of users:

//routes.php route::group(['middleware' => ['web'], 'prefix' => 'user'], function () {     route::get('/index', 'usercontroller@index')->name('user.index'); }); 

and here controller:

//usercontroller.php public function index() {     return view('user.index'); }  public function indexdata() {     $users = user::select(['id', 'name', 'email', 'created_at', 'updated_at'])->get();     return datatables::of($users)->make(); } 

the view:

// user\index.blade.php @extends('layouts.base')  @section('additional_styles')     <link rel="stylesheet" href="//cdn.datatables.net/1.10.7/css/jquery.datatables.min.css"> @endsection  @section('additional_scripts')     <!-- datatables -->     <script src="//cdn.datatables.net/1.10.7/js/jquery.datatables.min.js"></script>     <script>         $('#users-table').datatable({             "processing": true,             "serverside": true,             "ajax": '{!! route('user.index') !!}',             "columns": [                 {data: 'id', name: 'id'},                 {data: 'name', name: 'name'},                 {data: 'email', name: 'email'},                 {data: 'created_at', name: 'created_at'},                 {data: 'updated_at', name: 'updated_at'}             ]         });     </script> @endsection   @section('main-content')     <div class="container">         <div class="row">             <div class="col-md-10 col-md-offset-1">                 <div class="panel panel-default">                     <div class="panel-body">                         <table class="table table-bordered" id="users-table">                             <thead>                             <tr>                                 <th>id</th>                                 <th>name</th>                                 <th>email</th>                                 <th>created at</th>                                 <th>updated at</th>                             </tr>                             </thead>                         </table>                     </div>                 </div>             </div>         </div>     </div> @endsection 

but datatable doesn't work properly. after processing render tha data, show me alert response have invalid json format , says see datatables.net/tn/1. have tried see whithin developer tools of chrome see response couldnt!

any idea issue ?

now work in laravel 5.2.31,

`        route     route::get('datatables',['uses'=>'datatablescontroller@getindex', 'as' => 'datatables']);     route::get('datatables/{data}',['uses'=>'datatablescontroller@anydata', 'as' => 'datatables.data']);      controller       public function anydata()         {            $users = user::select(['id', 'name', 'email', 'created_at', 'updated_at'])->get();         return datatables::of($users)->make();         }      js     $('#users-table').datatable({             processing: true,             serverside: true,             ajax: '{!! url('datatables/data') !!}'         });` 

Comments