新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
使用jqueryDataTable和ajax向頁(yè)面顯示數(shù)據(jù)列表的方法-創(chuàng)新互聯(lián)
首先在html頁(yè)面定義好相關(guān)長(zhǎng)度的行和列,假設(shè)table的id=data-table“”

使用jquery DataTable在js中這么寫(xiě)
$(function() {
$('#data-table').DataTable(
{
order : [ [ 1, 'desc' ] ],
ajax : {
url : "/products",
type : 'GET',
dataSrc : ""
},
columns : [ {
data : "id"
}, {
data : "id"
}, {
data : "title",
defaultContent : ""
}, {
data : "sell_point",
defaultContent : ""
}, {
data : "price",
defaultContent : ""
},{
data : "number",
defaultContent : ""
},{
data : "image",
defaultContent : ""
},{
data : "cid",
defaultContent : ""
},{
data : "id"
}],
columnDefs : [{
targets : [ 0 ],
orderable : false,
render : function(id, type, row, meta) {
return '';
}
},{
targets: [8],
render: function(data, type, row, meta) {
return ''
}
}]
});
});
本文標(biāo)題:使用jqueryDataTable和ajax向頁(yè)面顯示數(shù)據(jù)列表的方法-創(chuàng)新互聯(lián)
文章位置:http://www.dlmjj.cn/article/hpsge.html


咨詢
建站咨詢
