Question

This is my code:

$.ajax({
                url: someUrl,
                type: "PUT",
                data: {
                    id: id,
                    message: "bla",
                    date: this.Date
                },
                success: function (data) {
                },
                error: function (data) {
                    alert("Failed to save.");
                }
            });

someUrl is a method for saving in database, and it gets called and is succeeded, it add new row in my table in database. But, I always get the alert. In 'data', there is error 500 and it says "The parameters dictionary contains a null entry for parameter 'date' of non-nullable type 'System.DateTime' for method 'MyMethod(Int32, System.String, System.DateTime)'".

Was it helpful?

Solution

This is likely not an error with your AJAX code, it's an error on the server side. Check logs on the server when you call someUrl.

In other words, the is AJAX call is 'succeeding', but the server is returning a 500 error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top