views:

72

answers:

1
+1  Q: 

JsonResult Problem

I have an ActionResult returning this :

return new JsonResult() { Data = new { isDeleted = isEntityDeleted } };

in javascript , the value returned by that ActionResult is "{"isDeleted":true}" , which is an object called data, but if i try to access data.isDeleted i get undifined

What am i doing wrong?

Edit:

javascript code:-

 $.post('<%=Url.Content("~/Test/Delete")%>/',{entityID:idRow}, function(data) {
   if(data.isDeleted){
     //never gets here even though isDeleted is true
   } else{ } });
+4  A: 

try post with the extra argument "json" at the end (last parameter).

cfr http://docs.jquery.com/Ajax/jQuery.post

Bavo
problem solved thank you
gigi
A vote would be nice then...
Bavo