ajax 接受流數據圖片

 $.post(url,json,function(data) {                    

            $("#images").attr("src""data:image/gif;base64," + data);

            console.info(data);

            window.location.href=data.resultUrl;

        });

這種形式,img 他只能接受16進制的數據,鼠疫,java,那邊要進行相應的轉碼

ByteArrayOutputStream out = new ByteArrayOutputStream();
ImageIO.write(image, "jpg", out);
outputStream.write(Base64.encodeBase64(out.toByteArray()));

https://bbs.csdn.net/topics/392083177

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章