我從數據庫中獲取數據,但其中一個是像這樣的'〜\ images \ food.png'的圖像文件路徑,但我想,但它在一個img標籤,所以它可以顯示圖像不是路徑。有人幫忙,請提前致謝。jquery datatables img在aoCoulumn
$(document).ready(function() {
load();
});
function load() {
$.ajax({
type: "POST",
url: "ParentCategoryManagment.aspx/PopulateCategories",
contentType: "application/json; charset=utf-8",
data: "{}",
dataType: "json",
success: AjaxSucceeded,
error: AjaxFailed
});
}
function AjaxSucceeded(respone) {
var json = jQuery.parseJSON(respone.d);
if (typeof oTable == 'undefined') {
oTable = $('#tblData').dataTable({
'aaData': json,
'aoColumns':
[
{ "mDataProp": "Id" },
{ "mDataProp": "Name" },
{ "mDataProp": "ImagePath" },
{ "mDataProp": null, "sDefaultContent": '<a class="edit" href="">Edit</a>' },
{ "mDataProp": null, "sDefaultContent": '<a class="delete" href="">Delete</a>' }
]
});
}
else {
oTable.fnClearTable(0);
oTable.fnAddData(json);
oTable.fnDraw();
}
}
function AjaxFailed(result) {
alert('Ajax Failed');
}
你好需要的信息你可以聊天嗎? http://chat.stackoverflow.com/rooms/22475/chattable – sajawikio
我不明白你的問題。添加更多信息。 – sdespont
sajawikio我不能聊天,因爲我需要20代表 – Thinker