I am inserting data into the database from AngularJS application. I create a data object and fill it with data then call post request.
I get an error Failed to load resource: the server responded with a status of 500 (Internal Server Error) but meanwhile the data does get entered into the database. Not sure why this is happening and what is going on
var inputData = {
"EntryDate": $filter('date')(curdate, 'yyyy/MM/dd hh:mm:ss'),
"Field1": $scope.$parent.field1,
"Field2": $scope.$parent.field2,
"SortOrder":1
};
var config = {
method: "POST",
url: window.baseApiUrl + '/PostEntry',
data: inputData
};
$http(config).
then(function (data, status, header) {
$scope.result = "Success"
console.log($scope.result);
}, function errorCallback(xhr) {
//print error to console.
console.log(header.responseText);
$scope.result = header.responseText;
});