Your code looks correct to me. So two questions for you:
- Are you sure
$('meta[name="csrf-token"]').attr('content')is returning the correct token? - Have you tried passing the headers to the ajax request alone and check if that works?
You can see in your browser console if the header was send with the request or not! That might be a good starting point to look where this is going wrong