简体   繁体   中英

CSRF Token mismatch on Ajax Form on change submission

I have a public form where it sends Ajax request on jquery onchange event, sometimes due to the number of requests sent in the time interval I'm starting to get TokenMismatchException.

I'm using the following way to send the csrf token:

$.ajaxSetup({ 

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

});

What would be the solution to my situation? Extending the csrf token lifetime? Thoughts?

如果调用没有操纵任何敏感信息,请将路由放在VerifyCsrfToken类中的except数组中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM