I am posting a form by ajax
as following
var jsonData = JSON.stringify($('#basic-info').serializeObject());
$.ajax( {
url : '/users/save-basic-info/'+userId,
type : 'POST',
data : jsonData,
success : function (data) {
console.info(data);
},
error : function (jqXHR, textStatus, errorThrown) {
}
});
This is what I get in post parameters
{"_token":"4WLag5Iqwg9fR61hNkNt4y9J3XffHlTfrNPYI0uS","name":"Test client","hospital_id":"3","end_date":"2016-12-01"}
as _token
is set in this request, still I am seeing Token Missmatch Exception
Add an ajaxSetup function to your Javascript like this.
Add a crsf-token field to your meta data like this. I placed it in my main layout file.