2015-04-02 21 views
1

我使用Krajee引導文件輸入插件,我希望它成功發佈後顯示圖像。但它不起作用。 這是我的代碼:如何在成功發佈後加載圖片預覽(Krajee引導文件輸入插件)

var resultTaiLieu = HopKhongGiay_SapXepLichHop_Service.getAllTaiLieuCuocHopByMaCuocHop(calEvent.id); 
      resultTaiLieu.then(function (p1) { 
       var result_Json = JSON.parse(p1.data); 
       console.log(JSON.stringify(result_Json)); 
       $("#FileUpload").fileinput({ 
        initialPreview: result_Json 
       }); 
      }) 

的console.log

["<img src='http://localhost:51157/Documents/5f189c85-238d-4e8d-a406-3f4ee83ac965_Untitled2.png'","<img src='http://localhost:51157/Documents/53c8a2e5-d031-4617-a020-c99da79aa72a_Untitled3.png'"] 

更新時間: 只需添加屬性 「刷新」 到文件輸入

$("#FileUpload").fileinput('refresh', { 
         initialPreview: result_Json 
        }); 

回答

0

您的結果的格式不正確, 。結果只需要包含保存圖像的鏈接,而不是img標籤。

["http://localhost:51157/Documents/5f189c85-238d-4e8d-a406-3f4ee83ac965_Untitled2.png","http://localhost:51157/Documents/53c8a2e5-d031-4617-a020-c99da79aa72a_Untitled3.png"]
相關問題