laravel中ajax,post传值问题

//laravel中有CSRF保护  不加的话会出现419错误
$.ajax({
  url: '/admin/user/'+id,
  type: "POST",
  data: {'_token': $('meta[name=csrf-token]').attr("content"), '_method': 'DELETE'},
  dataType: "JSON",
  sync:'true',
  success:function(data){
    console.log(data);
  },
  error:function () {
    console.log('error');
  },
  timeout:3000,
}); POST发送
$.post('/admin/user/'+id,{'_token':'{{csrf_token()}}',"_method": "delete"},function(data){
  console.log(data);
});
上一篇:Go在linux下的安装


下一篇:case class inheritance