[英]CSRF token mismatch error after uploading to host
after uploading to the host I get this message when I try to change something in the database via ajax knowing that it is working well in localhost上传到主机后,当我尝试通过 ajax 更改数据库中的某些内容时收到此消息,知道它在 localhost 中运行良好
"message": "CSRF token mismatch.",
"exception": "Symfony\\Component\\HttpKernel\\Exception\\HttpException",
"file": "/hermes/bosnacweb08/bosnacweb08ab/b1283/ipg.nmedcure47094/proxima/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
here is my ajax code这是我的 ajax 代码
$.ajax({
url: '{{ url('appointment') }}/update_status_doctor/' + appointment_id,
type: "PATCH",
data: {
'_token': "{{ csrf_token() }}",
'status': status,
'doctor': doctor,
},
here is route这是路线
Route::patch('/appointment/update_status_doctor/{id}', [AppointmentController::class, 'update_status_doctor'])->middleware('auth');
the solution that I did and it is not working is to put ob_start();我所做但它不起作用的解决方案是放置 ob_start(); in index.php in public
在 index.php 中公开
I guess you need to include change the ajax code to the following我想您需要将 ajax 代码更改为以下内容
$.ajax({ url: '{,: url('appointment'),:}/update_status_doctor/' + appointment_id: type, "POST": data, { '_token': "{{ csrf_token() }}", '_method': "PATCH", 'status': status, 'doctor': doctor, } }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.