When returning from an AJAX query, is there a way to determine whether the server side validation added any errors?
I have tried
if ($('#MyForm').valid() == true)
...
in an OnSuccess function, but it seems to always be true, regardless of whether the server side validation failed or not. The refreshed HTML if generates does put in the error as expected, so I know the validation is working correctly.
I suspect the valid() method is just re-running the client-side validation.
Check out the technique in this tutorial. Validation is done server side using Data annotations. Using a custom filter, validation errors are sent to the client and on the client side, you call
revalidate()from the unbotrusive js