我从ajax调用获取一个字节数组,现在我想将它转换为图像。我已经搜索过了,我找到了将字节数组转换为base64的方法。我的问题是如何在java脚本中将字节数组转换为base64,或者有没有办法通过字节数组显示图像?
$.ajax({
url: urlGetImages,
data: { id: id },
type: 'GET',
contentType: "application/json; charset=utf-8",
success: function (data) {
debugger;
totalImages = data.AdditionalData.ImagesByteses.length;
if (totalImages > 0) {
//data.AdditionalData.ImagesByteses[0] is array of bytes
var imagemarkup ="<img src"">" // I want to show image from this byte array
}
},
error: function () {
alert(error);
}
});