POST request
Use POST instead of GET
The library is smart enough to handle both POST and GET requests — you don't have to change anything in your server-side code.
The DataTables side only needs to send the CSRF token together with the request.
| Id | Name | Unit Price |
|---|---|---|
| Loading… | ||
<?php
use Ozdemir\Datatables\Datatables;
use Ozdemir\Datatables\DB\SQLite;
Route::post('/ajax/post-data', function () {
$path = dirname(__DIR__).'/database/Chinook_Sqlite_AutoIncrementPKs.sqlite';
$dt = new Datatables(new SQLite($path));
$dt->query('Select TrackId, Name, UnitPrice from Track');
return $dt->generate();
});