i’m using MVC2, and am trying to display a friendly error message to the user, here is how:
public ActionResult Foo()
{
Response.StatusCode = 403;
return new ContentResult() { Content="frindly error"}
}
However, i’m having trouble to find how to read it on the ajax OnFailure callback:
function ajaxErrorHandler(context) {
// this fires an error, saying it's not a JSON object
alert(context.get_response().get_object());
}
I can see in firebug that the response is correct.
Any ideas?
Here is the code:
This will display “frindly error”