0

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;
            });

1 Answer 1

3

Do you have access to the server code? Any chance it is erroring while executing an operatoon after the "write to DB" action is done? Maybe while formatting the response?

Sign up to request clarification or add additional context in comments.

2 Comments

Yes, it means that the server process has succeeded in writing to the database, and something has gone wrong after that. If you can look at the server logs it might tell you what the problem is.
I checked IIS logs but did not find any errors. Let me check the Web API code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.