Take a look https://laracasts.com/discuss/channels/laravel/need-some-advice-on-saving-a-ajax-form-data-into-l5
GET request retrieving the token
Are you asking about get or post?
I have spent weeks searching for a solution to this issue with no luck. I am running an application that utilizes a vast array of AJAX post requests to move and manipulate data. I have:
$.ajaxSetup({
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }
});
But it does not work as the token randomly changes [see screenshot of a back end GET request retrieving the token] resulting in a Token Mismatch error indefinitely until I refresh the page. I have an error catching method in place to keep reloading the meta tag until the right token is found but it is insanely inefficient and hackish. Is there no solution to this madness?
Screenshot: https://gyazo.com/7ab04e78ef75a80cf2a34aac493bd41e
Please or to participate in this conversation.