2014-03-12 40 views
0

情況是,我想在引導程序彈出窗口中打開一個圖像v2.3.1 而圖像是Base64格式。 在按鈕[ID =「imagePopoverButton」]的點擊時,酥料餅的窗口被打開,但底座64圖像沒有出現。無法在彈出窗口中顯示Base64圖像,引導程序

我分享下面的代碼片段中,如果有一個人能幫助我在故障排除一樣。

<!-- js func, which load Base 64 img format via Ajax --> 

function showImagePopover() { 
      $.ajax({ 
       url : getContextPath() 
         + "/app/Application/showImagePopover", 
       type : 'POST', 
       async : false, 
       success : function(jqXHR) { 
// In this scope, i have fetched the ajax image, but i am not been able 
//to show that up in popover 
       } 
      }); 
     } 
/***************************************************************/ 
<!-- Popover function js, html:true --> 

$("#imagePopoverButton").popover({ 
     content : showImagePopover(), 
     html : true, 
     trigger : 'click', 
     placement : 'right', 

    }); 

/***************************************************************/ 

<!-- via Clicking of the button, ajax call is suppose to load base64 image in popover --> 
<button type="button" class="btn btn-mini btn-primary" id="imagePopoverButton"  rel="popover">imagePopover</button> 

回答

0

添加評論下方以下

var image = new Image(); 
image.src = "data:image/png;base64," + jqXHR; 
image.id = "image_id"; 
image.width = '500'; 
image.height = '500'; 
$('#imagePopoverButton').html(image);