Experts,
The following function are successfully send data to the Controller.cs (server)
var ajaxResponse = $.ajax({
type: "post",
url: href,
dataType: 'json',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(postData),
success: function (msg) {
alert("Success");
}
})
but i am not able to get updated status from the following method
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult SaveData(TabMasterViewModel postData)
{
string message = "";
try
{
TabMasterViewModel update = new TabMasterViewModel();
update = _tabmasterService.GetSingle(r => r.colID == postData.colID);
UpdateModel(update);
_tabmasterService.Update(update);
message = "Success";
}
catch (Exception e)
{
message = e.Message;
}
return Content(message);
}
I would like to display message when failed or success. this following line never execute
success: function (msg) {
alert("Success");
}
but my server side code is executed without any error.
Please provide your valuable suggestions,
Thanks,
Imdadhusen
Instead of returning
ActionResultyou should be returningJsonResultFor example
then your JS