An error message is returned from the catch with json.I want to show this message but I can’t seem to catch it.
Controller :
public ActionResult GetTable()
{
try
{
...
}
catch (Exception ex)
{
........
return Json(new { result = false, message = "İşlem başarıyla gerçekleşti ancak tablo güncellenirken bir sorun oluştu." });
}
}
Js :
function updateTable(isInsert) {
var pageNumber = 1;
if (isInsert) {
pageNumber = 1;
} else {
pageNumber = $('#customersTable').bootstrapTable('getOptions').pageNumber;
}
$.get('/Customer/GetTable', function (data) {
$('#tableContainer').html(data);
$('#customersTable').bootstrapTable('destroy');
$('#customersTable').bootstrapTable();
$('#customersTable').bootstrapTable('selectPage', pageNumber);
})
.fail(function (jqXHR, textStatus, errorThrown) {
var response = jqXHR.responseText;
showToast('Başarısız', response.message, false);
});
}