使用创建的文件夹路径读取图像

时间:2018-11-06 00:17:37

标签: javascript html ajax

通过使用纯HTML,可以使用我的项目路径显示我的图像:

<img src="~/Content/img/MagnifierLoading.gif" alt="Loading">

但是,如果我要在获取表格时显示它,它将不会显示图像:

function image_loader() {                                       
        $(".sortable#DB tbody").html('<img src="~/Content/img/MagnifierLoading.gif" alt="Loading">');
    }

function LoadDB() {        
    $.ajax({
        url: '/Home/ReadDB',
        type: 'GET',
        start: image_loader(),
        dataType: 'json',
        success: function (data) {
            var row = '';
            $.each(data, function (i, item) {
                row += '<tr><td style="display:none;"  >' + item.Name + '</td><td>' + item.Age
                    + '</td><td width="50%">' + '<button style ="width:80px" type="button" class="btn btn-primary"> Add </button >' + '</td></tr>';

            });
            console.log(row)
            $('.sortable#DB2 tbody').html(row); // override previous results              
        },
        error: function (jqXhr, textStatus, errorThrown) {
            alert(errorThrown);
        }
    });

}    

0 个答案:

没有答案
相关问题