gpt4 book ai didi

javascript - Laravel x-editable CRSF 问题

转载 作者:行者123 更新时间:2023-11-28 04:58:01 24 4
gpt4 key购买 nike

我遵循了文档和另一篇支持文章,但我仍然陷入困境。我希望能够使用 x-editable 编辑字段。

  • 我使用了他们在 here 上所说的内容
  • 我在 View 文件中有 CSRF 元标记

我收到错误;

UnexpectedValueException in Response.php line 403:
The Response content must be a string or object implementing __toString(), "boolean" given.

杰斯。

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

$(document).ready(function() {


//toggle `popup` / `inline` mode
$.fn.editable.defaults.mode = 'inline';


$.fn.editable.defaults.params = function (params) {
params._token = $("meta[name=token]").attr("content");
return params;
};

$.fn.editable.defaults.send = 'always';

//make parking editable
$('#parking').editable();
});

最佳答案

在你的 Controller 中,执行

public function quicUpdate(Request $request, $id)
{
...
$event->save();
return response()->json($event); //This will return the whole event object
}

关于javascript - Laravel x-editable CRSF 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42382774/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com