$(function () {
$.ajaxSetup({
headers: {
'X-XSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
});
Add this to your $.ajax which you should use instead of $.post.
scosec said:
$(function () { $.ajaxSetup({ headers: { 'X-XSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); });
Add this to your $.ajax which you should use instead of $.post.
I actually tried using this example code before and I get the same result. I still get the same error when I comment out everything except 'Illuminate\Cookie\Middleware\EncryptCookies' in app.php's $app->middleware() method
What i need to do is only including this on my data of ajax
$.ajax({
data: {_token:'{{ csrf_token() }}'}
})
no need extra koding, and it works ! LoL
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community