Im using jQuery 1.9 with a few other libraries (kendo) and making an ajax call to an MVC controller. The controller method succeeds, but when there is no data to return (null), the ajax call does not enter the success block. Looking at other threads on this, I tried the following, but still it only falls into the success block if the call returns a non-null result.
My MVC controller returns a Jsonresult like this where retval is a collection of items
[update]
I think I am running into the issue mentioned here
jQuery post JSON fails when returning null from ASP.NET MVC
JsonResult j;
if(retval != null)
{
j = Json(retval, JsonRequestBehavior.AllowGet);
}
else
{
j = Json(new { }, JsonRequestBehavior.AllowGet);
}
return j;