I am trying to display the Assigned To
field in a table I am making with REST in SharePoint but all that is getting returned is [object Object]
. When I type this url into my website I can see the name of the person assigned to but it still does not show up in my table. Here is the code, all the other categories are displaying. Any help would be greatly appreciated.
<script type="text/javascript">
function LoadTasks()
{
var call = $.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('Tasks')/items?$select=Title,DueDate,OData__Author,Priority,AssignedTo/Title&$expand=AssignedTo",
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
}
});
call.done(function (data,textStatus, jqXHR){
$('#example').dataTable({
"bDestroy": true,
"bProcessing": true,
"aaData": data.d.results,
"aoColumns": [
{ "mData": "Title" },
{ "mData": "DueDate" },
{ "mData": "OData__Author" },
{ "mData": "Priority" },
{ "mData": "AssignedTo" }
]
});
});
call.fail(function (jqXHR,textStatus,errorThrown){
alert("Error retrieving Tasks: " + jqXHR.responseText);
});
}
LoadTasks()
</script>