开发者

ASP.NET MVC Intentional Ajax Failure

开发者 https://www.devze.com 2023-01-21 20:07 出处:网络
I am making an ajax call to my controller which is going to perform a long operation.The operation can fail for many reasons or succeed.If I want to force the 开发者_运维百科failure code of my ajax ca

I am making an ajax call to my controller which is going to perform a long operation. The operation can fail for many reasons or succeed. If I want to force the 开发者_运维百科failure code of my ajax call to execute ("error"), what do I need to do in my controller before returning? Just throw an exception?


Throwing an exception will lead to status code = 500 which will invoke the error handler, so it should be enough.

0

精彩评论

暂无评论...
验证码 换一张
取 消