Summer Sale! All accounts are 50% off this week.

alexmansour's avatar

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.

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

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

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

0 likes
0 replies

Please or to participate in this conversation.