author:咔咔
wechat:fangkangfk
这里放一个组装数据的案例,不会的可以参考一下
$.ajax({
type:"post",
url:"{url(Banner/index)}",//对应controller的URL
async:false,
dataType: 'json',
data:{
"page_index":page,
"page_size":limit,
},
success:function(ret){
total=ret.total;
var data1=ret.data;
var html= '';
for(var i=0;i<data1.length;i++){
html+='<tr>';
html+='<td>'+ data1[i].b_id +'</td>';
html+='<td>'+ data1[i]['banner_type']['vt_name'] +'</td>';
html+='<td>'+ data1[i]['banner_vs_video_name']['vi_title'] +'</td>';
html+='<td>'+ data1[i]['b_thumbnailUrl'] +'</td>';
html+='<td>'+ data1[i]['b_linkUrl'] +'</td>';
html+='<td>'+ data1[i]['b_sort'] +'</td>';
html+='<td>'+ data1[i]['b_showType'] +'</td>';
html+='<td>'+ data1[i]['b_targetType'] +'</td>';
html+='<td>'+ data1[i]['b_title'] +'</td>';
html+='<td>'+ data1[i]['b_slaveTitle'] +'</td>';
html+='<td>'+ data1[i]['b_linkUrlList']+'</td>';
html+='<td>';
html+='<a class="layui-badge-rim j-iframe" data-full="1" data-href='+ROOT_PATH+'/index.php/admin/banner/editBanner?b_id='+data1[i]['b_id']+' "href="javascript:;" title="编辑">编辑</a>';
html+='<a class="layui-badge-rim j-tr-del del" data-href='+ROOT_PATH+'/index.php/admin/banner/delBanner?b_id='+data1[i]['b_id']+' href="javascript:;" title="删除">删除</a>';
html+='</td>';
html+='</tr>';
}
$("#tab_list").html(html);
}
});