I created an action in my controller that will be used from jQuery Ajax method to validate user logon details. How can configure my action to throw an error that is detected by $.Ajax error handler?
I'm using the following code to throw an error, but it is not detected by $.Ajax.
throw new HttpException(401, "message");
Here is my JS code:
$.ajax({
url: $('#signin_submit').data('url'),
data: params,
type: "POST",
success: function (aData, aTextStatus, aJqXHR) { Signin.success(aData, aTextStatus, aJqXHR); },
error: function (aJqXHR, aTextStatus, anErrorThrown) { Signin.error(aJqXHR, aTextStatus, anErrorThrown); }
})