laravel-caffeine: not working for X-CSRF-TOKEN request header

Hi,

does this package also work for ajax request? its currently not working for me. i know it says it works for any page has _token, is ajax request included?

i did as laravel doc suggests:

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

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

update: i checked LaravelCafineDripMiddleware.php, and outputed $content. it turns out that the response content from my server is array instead of string since its not returning a view file. also it seems that the middleware is called twice. the first one returns content as string, the second one returns array.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

Just pushed update that should work on pages with the meta tag, no more fake forms! 😃