How to read modelstate errors when returned by Json?
- by learning
How can I display modelstate errors returned by Json ?
I want to do somthing like that...
if (!ValidateLogOn(Name, currentPassword))
{
ModelState.AddModelError("_FORM", "Username or password is incorrect.");
//Return a json object to the javascript
return Json(new { ModelState });
}
What must be my code in the view to read the modelstate errors and display them?
My actual code in the view is as follows to read the Json values:
function createCategoryComplete(e) {
var obj = e.get_object();
alert(obj.Values);
}