[Vuejs]-Laravel AJAX Request into route api Vue error

0👍

You have written:

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

This looks for a <meta> element, whose name is csrf-token, and parses out the content. So, for it to work, you need to add that meta tag to the document head. Try this:

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

Leave a comment