See the example
I return the object that contains ErrorCode & JsonResult (i.e List of Physician) from server side
public Result Get()
{
try
{
OResult.ErrorCode = 0;
OResult.JsonResult= OPhysicianRepository.GetAllPhysician();
return OResult;
}
catch
{
OResult.ErrorCode = 1;
OResult.JsonResult = null;
return OResult;
}
}
To Call on Physician view
$.getJSON('/api/physician', function (contactsJsonPayload) {
$(contactsJsonPayload.JsonResult).each(function (i, item) {
$('#physician').append('<li>' + item.name + '</li>');
});
});