adhik13th's avatar

datatables can showing data/result but sometimes often get error 404

I have a table and showing data and using Datatables Yajra to get search and pagination . This datatables is work ,showing data , all function is OK .

But if i reload this page,search some words , is often to showing error :

DataTables warning: table id=table1 - Ajax error. For more information about this error, please see http://datatables.net/tn/7

But , if i load again its normal . i dont know what happen , my script is not fault because this data is showing .

I am using laravel and still using Php Artisan Serve to start project. some poeple give me solution to using Xampp or Wampp , but i cant use it because its make me changed so many script.

how i can solved this ? if you using this datatbles , is you have same problem like i am ?

like this thread https://stackoverflow.com/questions/54700438/internal-server-error-when-running-running-yajra-datatable-using-php-artisan-ser

0 likes
3 replies
Tray2's avatar

Without any code it's very hard to give you an answer since we don't know what you are trying to do.

However if you have something like

public function show($id)
{
    return Model::findOrFail($id);
}

in your controller and you call try to find an id that does not exist you will get a 404 response.

https://mysite.com/api/books/1 this gives a 200 response if you have the id in the database

https://mysite.com/api/bokos/1000 this gives you a 404 if you don't have the id 1000 in you table.

adhik13th's avatar

but its not showing id , i just showing data from DB to parsing to tables . and i use ->get

public function indexDataTables4()
{

$riwayat = Data_riwayat_kgb::with('data_pns','data_pns.users')->get();
 
return Datatables::of($riwayat)->addIndexColumn()
->make(true);

}

Please or to participate in this conversation.