From my controller I am passing a list called ccdata through JSON. It only has 1 record which is a list.
return Json(rpata, JsonRequestBehavior.AllowGet);
In my view, I tried to pull the value of FirstName and LastName but got an error - 'FirstName.0' is null or not an object:
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: '@Url.Action("GetRpInfo", "PgController")',
data: { ID: ID },
dataType: "json",
success: function (rpdata) {
var rpinfo = rpdata.FirstName[0] + " " + repdata.LastName[0];
}
});