我有一个对我的 Controller 操作的 jquery ajax 调用。 现在在我的 Controller 中,它发生了。现在我需要调用 ajax 调用的错误函数。如果我抛出错误,这会起作用。有没有其他方法来调用错误函数。
顺便说一句,我的 Controller 操作的返回类型是 string/void。
最佳答案
将其写入您的 Action Throw new HttpException();
这将调用您的 ajax 函数的错误,并使用此 $.ajax 方法函数处理它 error:function() {do something }
关于asp.net-mvc - 从 Controller 的 catch 中向 ajax 调用发出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17073015/