CSRF Token mismatch on Ajax Form on change submission

Viewed 514

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?

1 Answers
Related