Laravel Token Mismatch Error in AJAX Set token on tag


Example

Add below function to your <form> tag. This function will generate a hidden field named _token and filled value with the token.

{{csrf_field()}}

Add csrf_token () function to your hidden _token in the value attribute. This will generate only encrypted string.

<input type="hidden" name="_token" value="{{csrf_token()}}"/>.