My Scenario :
My .getJson Method is in this skeleton.
$.getJSON(url, { /*data*/ },
function (result) {
/*Action BLOCK*/
if(result != null)
{ //Block 1 }
else
{ //Block2 }
}
}
My Doubt:
This is my return statement in controller.
Case 1 :
return Json(masterAccounts, JsonRequestBehavior.AllowGet)
Now If masterAccounts
is null
, then the getJSON is not at all going inside the Action Block. Though the status shows 200 OK, in response tab, it shows as No Response to show
Case 2 :
return Json(masterAccounts??new List<Account>(), JsonRequestBehavior.AllowGet);
Now, everything is working fine. In response tab I am getting as [] as expected.
My Question : Do the Action block of getJson executes even null value returned from server? I have tried this link., http://api.jquery.com/jQuery.getJSON/ But I saw no conditions like that.
In Mozilla too, I had same effect. The control is not going inside the Action Block.