我正在使用datatable来显示表中的记录并调用ajax来获取服务器端的响应,如果我添加“success”回调功能,它可以正常运行Ajax中的“success”回调属性, aoColumnDefs没有加载服务器端数据,任何人都可以告知这个问题的原因是什么,或者我错过了什么?
请参阅下面给出的示例代码。
$('#country').dataTable({
"autoWidth": true,
"processing": true,
"scrollY" : 450,
"language": {
"zeroRecords": "",
"emptyTable": "No Data Available",
"loadingRecords": "",
"processing": "Processing ",
},
"ajax": {
"url": serviceURL,
"type": "POST",
"contentType": 'application/json',
"dataType":"json",
"data" : function ( d ) {
return JSON.stringify(request)
},
"success": function(data, textStatus, jqXHR)
{
// Based on the server side response i am trying to show the response that is result data or exception message.
}
},
"aoColumnDefs" : [ {
"mData": "location",
"sWidth": "15%",
"title": column1Title,
},{
"mData": "date",
}
]});
我的目标是基于服务器端响应,我想显示结果表或异常消息。
答案 0 :(得分:1)