laravel ajax csrf code example
Example 1: laravel csrf token ajax post
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
Example 2: name csrf token laravel mismatch
<meta name="csrf-token" content="{{ csrf_token() }}" />
Example 3: laravel meta csrf
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});