akashpatel
1 month ago
510
19
Laravel

419 CSRF token Unknow status handle

Posted 1 month ago by akashpatel

Hello,

I have a one-page web site with Laravel latest with the step of forms.

Now each stepwise ajax request is call and get the data from Controllers.

But some time 419 is comes due to laravel session is expired. So at that moment how can i handle the 419 unknow status error.

I already pass : CSRF token in meta tag

<meta name="csrf-token" content="{{ csrf_token() }}" />

AND while Ajax request :

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

Problem is that how can I told the user to you need to page refresh once 419 is come in ajax post request. i mean how to handle it ? is there any idea?

I tried from the last 3 days to fix it.

Thanks in advance.

Akash Patel

Please sign in or create an account to participate in this conversation.