简体   繁体   中英

Laravel 5.5 csrf error with Datatable service

I create datatable with Laravel datatable service . This datatable has filters, when i apply filters and use post to find results return

The page has expired due to inactivity. Please refresh and try again.

The debugbar return

VerifyCsrfToken.php#70

In console

Failed to load resource: the server responded with a status of 419 (unknown status)

My route is

Route::match(['get', 'post'],'visitas/listado', 'VisitasController@listado');

So ¿why can´t I use post to search in filters? ¿Why return VerifyCsrfToken.php#70?

This may be problem of token which is expected. Please insert this in javascript file or layout template.

    $.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM