我从api获取数据,我希望它显示在数据表中,但我得到无效的JSON响应。 这就是我在做什么。 我对API的回应
{
"status": 200,
"message": "Success",
"data": [
{
"order_id": "11204",
"ins_url": "https://www.instagram.com/p/BNXavo0hdBH/",
"quantity_total": "50",
"price": "0.0600",
"quantity_done": "0",
"status": "0",
"added_time": "1481779270"
},
{
"order_id": "11205",
"ins_url": "https://www.instagram.com/p/BNXavo0hdBH/",
"quantity_total": "50",
"price": "0.0600",
"quantity_done": "0",
"status": "0",
"added_time": "1481779413"
}]
}
我的数据表代码:
jQuery.post(
ajaxlink.ajax_url,
{
'action': 'getorderhistoryapi'
},
function (response) {
$('#ViewUserDatatable').DataTable({
processing: true,
serverSide: true,
columns: [
{data: "order_id"},
{ data: "ins_url" },
{ data: "quantity_total" },
{ data: "price" },
{ data: "quantity_done" },
{ data: "status" },
{ data: "added_time" }
]
});
});