When I am submitting form via Ajax, I have 2 ways of showing the user validation error messages:
1) If everything is ok return Json(new { Status = true }), if there are errors return View(model) in controller. And then on client side something like if (response.Status == undefined) $("#formWrapper).html(response) which will replace form with new one which contains error messages.
2) If everything is ok return Json(new { Status = true }), and if there are errors return Json(new { Status = false, Errors = errorList }) and then on client side go through errorList and append messages to elements.
Which one should I choose?
Note: I know I have client side validation and request wont be submitted at all if there are errors, but there are some things that need to be checked on backend and cant be put in client side validation, so I need mechanism to return info about validation errors from controller.
$.validatorto be re-parsed