ValidationSummary can easly display error messages.
But how can I make it a success message I return from my action.
I am calling this action within Ajax request.
Any idea?
ValidationSummary can easly display error messages.
But how can I make it a success message I return from my action.
I am calling this action within Ajax request.
Any idea?
As you've discovered ValidationSummary is for displaying error messages. If you are using AJAX you could have your action return messages in JSON:
[HttpPost]
public ActionResult Foo()
{
// Do something
return Json(new { message = "success" });
}
And then call it:
$.post('/home/foo', { }, function(json) {
alert(json.message);
});