情况是,我想在bootstrap popover v2.3.1中打开一个图像 图像采用Base64格式。 单击按钮[id ='imagePopoverButton']后,弹出窗口打开但基本64图像未显示。
我正在分享以下代码段,如果有人可以帮我解决问题。
<!-- 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 :(得分: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);