1
我想從我的數據庫中顯示圖像,該圖像存儲圖像位置的路徑。以下代碼僅在輸出中爲我提供圖像路徑。爲了使圖像顯示而不是圖像路徑,需要做出什麼改變?如何使用jQuery顯示數據庫中的圖像而不是圖像路徑
GetBusinessCategoryList: function() {
debugger;
var data = JSON2.stringify({
});
$.ajax(
{
contentType: "application/json; charset=utf-8",
type: 'POST',
url: 'http://localhost:44719/Modules/BusinessCategoryView/Service/BusinessCategoryWebService.asmx/GetAllBusinessCategory',
dataType: 'json',
data: data,
success: function (result) {
alert("ok");
var returnedData = result;
BusinessManagement.BindBusinessCategoryList(returnedData);
},
error: function (error) {
alert("error");
}
});
},
BindBusinessCategoryList: function (data) {
debugger;
var cLst = data.d;
if (cLst.length > 0) {
headElements += '<table id="customerTable" cellspacing="0" cellpadding="0" >';
headElements += '<thead class="sfHeadingone">';
headElements += '<tr><th align="left">Category Image</th>';
;
headElements += '</thead>';
$('#tblGrid').html(headElements);
var i = 0;
if (i === 0) {
bodyElements += '<tbody>';
}
$.each(cLst, function (index, value) {
bodyElements += "<td>" + value.CategoryImage + "</td>";
}
});
非常感謝。這部分解決了我的問題,因爲控制檯仍然顯示「無法加載資源」,但我應該能夠弄清楚這一點 –