Hi everyone i have the following situation: I have a view in which I have a save button that is serializing a form and sending it by Ajax to a JsonResult in the Controller. Inside this JsonResult I'm adding/editing tables in the database. My question is if is possible to return a confirmation box to the view if a certain condition exists. Bellow is my code. Thanks in the advance :)
This is the javascript in my view that is sending the form-data to the controller by ajax.
<script>
function submitForm() {
$.ajax({
type: 'POST',
url: '@Url.Action("UpdateEvent", "EventCalendar")',
data: $('#UpdateEventForm').serialize(),
success: function (eventoId) {
$('#modal-edit-event').modal('hide');
$('#calendar').fullCalendar('refetchEvents');
}
});
}
This is my Controller code that is receiving the form-data:
public JsonResult UpdateEvent(.........)
{
List<Guid> usersChanged = new List<Guid>();
.
.
.
if(usersChanged.Count() > 0)
{
//Here is where i want to call a confirmation box
}
.
.
.
return Json(eventId, JsonRequestBehavior.AllowGet);
}
}