我有一个ActionResult返回:
return new JsonResult() { Data = new { isDeleted = isEntityDeleted } };
在javascript中,ActionResult返回的值是“{”isDeleted“:true}”,这是一个名为data的对象,但如果我尝试访问data.isDeleted我会得到unifined
我做错了什么?
修改:
javascript代码: -
$.post('<%=Url.Content("~/Test/Delete")%>/',{entityID:idRow}, function(data) {
if(data.isDeleted){
//never gets here even though isDeleted is true
} else{ } });