0
我有,供應及包括身份證結果和jsonrpc鍵OFA JSON字符串給出的模式rerurns JSON一個JSON RPC服務器使用返回的JSON的給定部分製作jQuery的數據表中提取,並從RPC服務器
{
jsonrpc: "2.0"
id: "1"
result: "{"iTotalDisplayRecords":"2","iTotalRecords":"2","aaData": [["1","Kenya","Nairobi","0","34"],["2","USA","New York","70","38"]],"sEcho":0}"
}
現在問題就來了在響應進來的Web瀏覽器後的DataTable剛剛從服務器永遠
我試圖嘗試添加顯示裝載儀數據
..."sAjaxDataProp":"",...
但導致找不到匹配的行。我在Rpc服務器中使用了與cgi腳本相同的coe,並發現我得到了所需的輸出,並且表格填充得很好。從腳本JSON響應是
{"iTotalDisplayRecords":"2","iTotalRecords":"2","aaData":[["1","Kenya","Nairobi","0","34"],["2","USA","New York","70","38"]],"sEcho":1}
我想以某種方式告訴給數據表只選擇jsonrpc請求的結果的一部分,以顯示返回的數據符合市場預期。
這裏是我的javascript發送datapart
oTable=$('#ip_data').dataTable({
"bProcessing": true,
"bServerSide": true,
"bPaginate": true,
"bScrollCollpase": true,
"sScrollY": "200px",
"sAjaxSource": "/url",
"fnServerData": function (sSource, aoData, fnCallback, oSettings) {
aoData.push({"name":"method","value":"datatables"});
aoData.push({"name":"id","value":"1"});
oSettings.jqXHR = $.ajax({
"dataType":"json",
"type":"GET",
"url":sSource,
"data":aoData,
"success":fnCallback
});//END OF AJAX
}//END OF FNSERVERDATA
});//END OF DATATABLE
通過使用console.log(json.result)我得到所需的響應。爲什麼fnCallback沒有填充表格,當我給它的json.result的參數,就像這個「成功」:function(json){console.log(json.result); fnCallback(json.result);說無法讀取未定義的屬性「長度」 –
同樣的問題... – diank