I have a lookup field in SP2013 list which I am trying to get list items using Javascrip and CAML. My function is as follow:
$(function () {if (healthInfoQuery && healthInfoQuery.Rows) {
var liHealthInfoHTML = [];
$('#healthinfo_list').toggle();
$.each(healthInfoQuery.Rows, function (index, r) {
liHealthInfoHTML.push('<li><a href="/Subsite/Documents/' + r.HealthInfo + '">' + r.Title + '</a></li>');
});
$('#healthinfo_list ul').html(liHealthInfoHTML.join(''));
}
});
Which HealthInfo is the lookup field. The return value is undefined. I need to return a value of the lookup using the above and then in my CAML, I will have HealthInfo field as ViewFields parameter.
<FieldRef Name='Title'/><FieldRef Name='HealthInfo'/>
Any help is much appreciated.