I am currently experiencing something strange with one of my routes' responses and haven't been able to find any information elsewhere.
So, let's say I make a call to a route in my controller with JQuery, like this. It's a POST action and I expect JSON data.
// Send the data
$.ajax({
type: "POST",
enctype: 'multipart/form-data', //'application/json',
url: "/Claims/Application/SaveCurrentFormData",
data: data,
dataType: 'json', // we're expecting back a json
processData: false,
contentType: 'application/json',
cache: false,
timeout: 600000,
success: function (result) {
for (var formCode in result.forms) {
var selector = "[data-formcode='" + formCode + "']";
$(selector + " [name='TicketDocumentId']").val(result.forms[formCode]);
}
for (var documentName in result.documents) {
var selector = "input[name='" + documentName + "']";
$(selector).data("ticketdocumentid", result.documents[documentName]);
}
resolve(true);
},
error: function (e) {
// Debug
console.log("Error saving form data: ", e.message, e);
resolve(false);
}
});
On my method, I process some data and send a serialized version of the resulting data object:
// Build results object
saveResults.Add("forms", newForms);
saveResults.Add("documents", newDocs);
string dataJson = JsonConvert.SerializeObject(saveResults);
// Return a list of updated ticket documents with their respective IDs
return Content(dataJson);
A few days ago is when I originally wrote this. It was working, I was getting my JSON data back on the client. But something happened, I'm not sure when, and now all I get as a response is a literal "500". Please take a look at the screenshot:
I've tried using "return Json(saveResults)", and also different combinations, like expecting text instead of JSON in my POST action, and things like that. The thing is that no matter what I do, the response is always the same: "500". The status code is "200", though, so I don't really understand...
Any pointers would be greatly appreciated. This is a critical moment in the development of this project and I can't wait too long to fix this. :(