Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-DATATABLES. Consider upgrading your project to laravel-datatables 11.0.

Html Builder Post Ajax

Use post method to submit the dataTables ajax request.

See datatables.net official documentation for ajax option for details.

Syntax

$builder->postAjax($attributes);

Post Ajax Parameter

Ajax parameter ($attributes) can either be a string or an array.

String Attributes

When the attribute passed is a string. The builder will treat this as the URL where we fetch our data.

$builder->postAjax(route('users.data'));

{tip} Setting ajax to null or empty string will use the current url where DataTables was used.

Array Attributes

Attributes are the same with the ajax() method request valid parameters.

$builder->postAjax([
'url' => route('users.data'),
])