On the client, I am doing a standard ajax call to an MVC action.
$.ajax({
type: "POST",
url: '/FileUpload/CheckGuess/',
dataType: "json",
contentType: "application/json; charset=utf-8",
data: jsonSerialized,
success: function (result) {
console.log(result);
dfd.resolve();
},
error: function (error) {
console.log(error);
dfd.reject();
}
});
My CheckGuess action returns a JsonResult. I want to notify an ajax call that there was an error to invoke error: handler. How do I do it with HTTP response (I've read it's better then sending obligatory json and parsing it in a success: handler.