i am using MVC c# i have a object with
public class Person
{
public int TypeId { get; set; }
public string Code { get; set; }
}
i have a code that retruns JSON object for this object like this
return Json(personCodeStore.GetPersonCodes(id).Select(x=>new {text =x.Code, value =x.TypeId}), JsonRequestBehavior.AllowGet);
how do i add a Indicator to my JSON return data, so that i can check for empty data
$.getJSON('../PersonList?id=1', function (data) {
if (data==????)
{
alert("has data");
}
else
{
alert("is Empty");
}
}
Could you just check for a property you know a Person object would have? Something like this: