So I have an ajax call that is returning data that contains two objects at the root. One is LastRefresh which is just the number of ticks and I'm not using it with my DataTable but I am using elsewhere. The other is a list of strings (SKUs) which I want to display in a DataTable. The data comes back fine but I haven't been successful yet in having datatables use the nested object called SKUs.
fbaSKUTable = $('#fbaSKUs').DataTable({
ajax: {
'url': '/api/FBA/RefreshSKUS',
'dataSrc': 'skuData',
'type': 'GET',
'success': function (data) {
skuData = JSON.stringify(data.SKUs);
storage.setItem("lastRefresh", JSON.stringify(data.LastRefresh));
storage.setItem("fbaSKUs", JSON.stringify(data.SKUs));
},
'failure': function (data) {
console.log('failure');
}
},
"columns": [
{"SKU": "SKU"}
]
});
Here is some sample data
{"LastRefresh":"636826452200968391","SKUs":[{"SKU":"AB-BROWN"},{"SKU":"ZAR-FEO1"},{"SKU":"ZZZ-FROST"}]}