这是我的服务器响应。
{
"status": "success",
"data": [{
"id": null,
"reportType": "Total Voucher Report",
"reportModule": "Vouchers",
"reportData": [{
"id": "1",
"voucherPackId": "2",
"serialNumber": "0",
"status": "Free",
"isBlocked": "N",
"voucherPin": "0",
"buyDate": null,
"redeemDate": null,
"phoneNumber": null,
"statusCode": null,
"identifier": "MCM0007532",
"merchantName": "test1",
"voucherName": "fddf",
"expiryDate": "2016-02-24 00:00:00",
"dealCategory": "Hotels \u0026 Travel",
"shortDescription": "xvxv",
"voucherWorth": "33.00"
}, {
"id": "2",
"voucherPackId": "2",
"serialNumber": "0",
"status": "Free",
"isBlocked": "N",
"voucherPin": "0",
"buyDate": null,
"redeemDate": null,
"phoneNumber": null,
"statusCode": null,
"identifier": "MCM0007532",
"merchantName": "test1",
"voucherName": "fddf",
"expiryDate": "2016-02-24 00:00:00",
"dealCategory": "Hotels \u0026 Travel",
"shortDescription": "xvxv",
"voucherWorth": "33.00"
}, {
"id": "3",
"voucherPackId": "2",
"serialNumber": "0",
"status": "Free",
"isBlocked": "N",
"voucherPin": "0",
"buyDate": null,
"redeemDate": null,
"phoneNumber": null,
"statusCode": null,
"identifier": "MCM0007532",
"merchantName": "test1",
"voucherName": "fddf",
"expiryDate": "2016-02-24 00:00:00",
"dealCategory": "Hotels \u0026 Travel",
"shortDescription": "xvxv",
"voucherWorth": "33.00"
}]
}],
"message": null}
我用它作为,
vm.dtOptions = DTOptionsBuilder
.newOptions()
.withOption('ajax', {
url: config.base_url + 'report/voucher?module=Vouchers&type=Total Voucher Report&merchant=1',
type: 'POST',
dataSrc: 'data.data[0].reportData[0]',
})
.withOption('processing', true)
.withOption('serverSide', true)
.withBootstrap()
.withPaginationType('full_numbers');
它说无效的 JSON 响应。感谢您的热心帮助。调试结果:http ://debug.datatables.net/urizon