Is there a way that I can pass in N/A as default if there is no results? I want to be able to define it as "N/A" if the mapped object is empty on Title.
Some of the items under Media_x0020_Specialist_x0028_s_x.results
return, but then some items are not returning and I'm getting that error.
Code:
$.ajax({
url: requestUri,
type: "GET",
dataType: "json",
cache: false,
headers: {
accept: "application/json; odata=verbose"
},
success: function success(data) {
onSuccess(data);
ExportTable();
}
});
function onSuccess(data) {
var item = data.d.results;
for (var i = 0; i < item.length; i++) {
tableContent += "<tr>";
tableContent +=
"<td>" +
item[i].Franchises_x0020_with_x0020_Shar.results
.map(function(r) {
return r.Title;
})
.join("; ") +
"</td>";
tableContent +=
"<td>" + item[i].Stand_x0020_Alone_x0020_Franchis + "</td>";
tableContent +=
"<td>" +
item[i].Franchise_x0020_Liason.results
.map(function(r) {
return r.Title;
})
.join("; ") +
"</td>";
tableContent +=
"<td>" +
item[i].Media_x0020_Specialist_x0028_s_x.results
.map(function(r) {
return r.Title;
})
.join("; ") +
"</td>";
tableContent += "</tr>";
tableContent += "</tbody></thead>";
}
$("#title").append(tableContent);
}