I am using Ajax.BeginForm(...
in asp.net MVC 2.0
- 400 (validation error)
- 200 (if everything is OK)
I would like to use new AjaxOptions{UpdateTargetID="ajax-form", OnSuccess="...", OnFailure="..."}
to handle these scenarios, however If I return a statuscode of 400 the UpdateTarget does not update my html.
Is there a way to have this update occur for "failures" as well as successes?
Typically, servers don't return meaningful content for 4** errors. When they do, browsers don't tend to bother to display it. So, no, I don't think MVC is being overly finicky here.
If you think 400 is the right response from your server, then your choices are to use $.ajax()
instead of Html.BeginForm
or to handle OnFailure
.
精彩评论