ajax post总是报"CSRF token mismatchjquery
在laravel中laravel
$.ajax({ headers: { 'X-CSRF-TOKEN': "{{ csrf_token() }}" }, url: "{{ url('user/doinfo') }}", type: "POST", contentType: false, processData: false, async: true, data: FormData, dataType: "json", success: function(data) { if (data.code == 200) { alert('update success'); setTimeout("window.location.reload()", 1000); } else { alert(data.message); } }, error: function(jqXHR) { alert('something error:'.jqXHR); } })
改设置的都设置了。后来发现是jquery版本过低了(jquery1.42.min.js),换成高版本jquery-3.5.1.min.jsajax