内容纲要

[code language=”js”]
$.ajax({
type: "POST",
data: {"_token": "{{ csrf_token() }}","id": id},
url: some_url,
success: function(msg){
// do whatever you want with the response
}
});
[/code]
将 csrf-token 放在 meta 标签
[code language=”html”]
<meta name="csrf-token" content="{!! csrf_token() !!}">
[/code]

[code language=”js”]
$.ajax({
type: "POST",
data: {"_token": $(‘meta[name="csrf-token"]’).attr(‘content’)},
url: some_url,
success: function(msg){
// do whatever you want with the response
}
});
[/code]

发表评论

电子邮件地址不会被公开。 必填项已用*标注