Quantumass soufiane Quantumass soufiane - 1 year ago 257
Ajax Question

MethodNotAllowedHttpException - CSRF -laravel 5.2

I'm using ajax to post a request then it refresh a part of the site with jquery function "load" and it's working good but when I try to redo this post it says MethodNotAllowedHttpException I think the problem in laravel csrf protection because after I refresh the whole page it works fine
my problem is how can I save the csrf token even if I refresh a part of site ?
** thanks in advance ** (ᵔᴥᵔ)

Answer Source

It is usually recommended to pass the csrf token to the web-page in meta tags (which are inside <head></head> tags)

 <meta name="_token" content="{{  csrf_token() }}" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download