问题
Though I am using {{ csrf_field() }}
in my html file still got POST http://localhost:8000/add_user 500 (Internal Server Error)
here is my code
$.ajax({
url:"/add_user",
type: 'post',
data: {_token : token, user_type_id : user_type_id, full_name : full_name, email : email, password : password, username : username, date : date},
success:function(msg){
$("#report").load(location.href + " #report");
}
});
回答1:
you can do this with csrf token
$.ajax({
type: "POST",
url: "url/update",
dataType: 'json',
data: 'id=' + id+ '&_token={{csrf_token()}}',
回答2:
provide your server router, its seem
s like you`ve missed this route request on your server
来源:https://stackoverflow.com/questions/48185723/post-500-internal-server-error-ajax-though-using-csrf-token-in-laravel