//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);
});
网友评论