我在js页面上获取数据库的数据,并用ajax更新页面,但是一直提示table id ajax 错误,怎么解决

jxq540312678 2016-07-28 10:55:54
$(function(){
/** 初始化 表格*/
$("#departTable").page(Util.tableSetting());
});

var Util = {
/** Table 设置*/
tableSetting : function() {
var setting = {
scrollX: true,
processing: true, //打开数据加载时的等待效果
serverSide: true,//打开后台分页
ordering: true,
search: {
smart: false
},
ajax: {
"url": $("#base").val() + "/department/departmentPage.jhtml?columnName=DEPART_ID",
"data": function ( d ) {
//添加额外的参数传给服务器
//d.extra_search = level1;
}
},
"columns": [
{ "data": "DEPART_ID" },
{ "data": "DEPART_NAME" },
{ "data": "DEPART_CODE" },
{ "data": "DEPART_TYPE" },
{ "data": "DEPART_SORT" },
{ "data": "CREATE_TIME" }
],
"columnDefs": [
{
"render": function(data, type, row, meta) {
return '<button type="button" class="btn btn-primary btn-flat" onclick=updateRoleInfoById(this,"'+row.departId+'")>修改</button>'+
'<button type="button" class="btn btn-primary btn-flat" onclick=deleteRoleInfoById(this,"'+row.departId+'")>删除</button>'+
'<button type="button" class="btn btn-danger deleteClass" style="display:none" onclick=deleteData(this,"'+row.departId+'")>是</button> <button type="button" class="btn btn-danger deleteClass" style="display:none" onclick=noDelete(this,"'+row.id+'")>否</button>';
return '';

},"targets": 0,orderable: false
},{
"render": function(data, type, row, meta) {
return row.departName;
},"targets": 1,orderable: true
},{
"render": function(data, type, row, meta) {
return row.departCode;
},"targets": 2,orderable: true
},{
"render": function(data, type, row, meta) {
return row.departType;
},"targets": 3,orderable: true
},{
"render": function(data, type, row, meta) {
return row.departSort;
},"targets": 4,orderable: true
},{
"render": function(data, type, row, meta) {
return row.createTime;
},"targets": 5,orderable: true
}
]
}
return setting;
}

}


错误原因如图所示
...全文
730 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jxq540312678 2016-07-28
  • 打赏
  • 举报
回复
为什么没有人啊
jxq540312678 2016-07-28
  • 打赏
  • 举报
回复

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧