I have a question about ajax call: here is my ajax call:
$.ajax({
url: "/Article/DeleteArticle/"+id,
type: "GET",
error: function (response) {
},
success: function (response) {
}
});
And here is my controller:
public ActionResult DeletePicture(int id)
{
bool success = Operations.DeleteArticle(id);
return null;
}
I would like to know what shoulud I will return to get inside the error? And when is this error function called mainly? If the error occurs on the server or ..?
And regarding success, how can I transfer some data there?
Real life example:
Imagine that I call this ajax method to delete an article when it is deleted, so success I would like to show a success message. If this failed in my action, I get success = false, I would like to show another message, for example: failed.
How to do it?
source
share