Hello,
I have this code :
$(document).ready(function() {
$('.DOFFDelete').click(function() {
var id = $(this).attr("id");
$.post("/Customer/DayOffDelete", { customerid: getCustomerId(), doffId: id }, function(data) {
$("#myFormDOFF").html(data);
});
});
});
In the Controller, I have this :
CustomerDayOff customerDayOff;
try
{
.....
}
catch (Exception ex)
{
return View("ErrorTest",ex.Message);
}
return View("CustomerDetail");
When an exception occurred, I'd like didn't change anything in "myFormDOFF" but display the exception message in "myFormMessage".
Questions : 1. In the jQuery code, how can I make the difference between a valid result and an exception ?
- Is there a way to use the the controller "Home" (or another shared controller) and "ShowError" action to display the error of all controllers by using for example RedirectToAction instead of return View("ErrorTest",ex.Message); ?
Thanks,