Dear Experts,
In mvc3-i want some stuff to be perform in background and its callback comes again to the same page getting 2 things-"Exception" & "IsSuccessfull". For that i am using Ajax()-
$.ajax({
url: '//localhost:1787/Table/Index/',
type: "POST",
data: JSON.stringify(tb),
dataType: "json",
contentType: "application/json; charset=utf-8",
async:true,
success: function (data) {
$('.result').html(data);
alert('success');
},
error: function () { alert("error"); }
});
This action method working fine. TableModel have 2 property Error(of type exception) and IsSuccessfull(bool),these are the properties which i actually want..so that in error function() of ajax() i can get the Error property. how to go,don't know??
public ActionResult Index(TableModel tb)
{
string tablename = tb.TableName;
TableModel tableModel = new TableModel();
try
{
....doning some stuff, getting the result in "var result".
if (!result.IsOperationSuccessful)
{
tableModel.Error=result.Error;
}
}
catch (ArgumentNullException ex)
{
tableModel.Error = ex;
}
catch (ArgumentException ex)
{
tableModel.Error = ex;
}
return View(tableModel);
}