我收到了像
这样的错误来自服务器的Json数据无法解析。这是由JSON格式错误引起的。
服务器文件
$details =array('name' => $rows_fetch['name'], 'latitude' => $rows_fetch['currentLatitude'], 'longitude' => $rows_fetch['currentLongitude'], 'email'=> $rows_fetch['contactEmail'], 'imei'=> $rows_fetch['imei_number'],'managerName'=> $managerName);
array_push($device_details['devices'],$details);
$device_details['total_pages'] = $total_pages;
$response = json_encode($device_details);
echo $response;
JS中的数据表
$('#DataTable').dataTable( {
"bProcessing": true,
"bRetrieve": true,
"bServerSide": true,
"sAjaxDataProp":[],
"fnServerParams":function(data){
console.log(data);
},
"sServerMethod": "GET",
"sAjaxSource": "php/totalDevices.php",
"sAjaxDataProp": "data.inner",
"aoColumns": [
{ "mData": "details.name", "sTitle":"User Name" },
{ "mData": "details.managerName" },
{ "mData": "details.imei" },
{ "mData": "details.email" },
{ "mData": "details.latitude" }
],
});