开发者

How to force OnFailure in MVC AjaxRequest or otherwise parse results?

开发者 https://www.devze.com 2022-12-26 20:51 出处:网络
I have specified a Javascript function for the \"OnSuccess\" event of an MVC ajax form. However, I do not want to carry out the \"OnSuccess\" event depending on certain conditions such as the Modelsta

I have specified a Javascript function for the "OnSuccess" event of an MVC ajax form. However, I do not want to carry out the "OnSuccess" event depending on certain conditions such as the Modelstate being invalid. How do I intercept and 开发者_Go百科and check the modelstate of the patial view OR force acomplete failure and run OnFailure event?

AND THEN, CAN I SPECIFY A DIFFERENT UpDateTarget?


Change the HttpResponse StatusCode of your Response object

[EDIT] To update a different target you can play with the response object in the event handlers More explanation of the MS ajax process here

0

精彩评论

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