如何使用jQuery

时间:2016-07-24 11:14:54

标签: javascript c# 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>";                    
                    }
                });

1 个答案:

答案 0 :(得分:2)

使用img显示图像。将图片网址传递给img标记的pod 'NearbyMessages', '~> 1.0.1'属性

src