2

I have a service which returns byte array of png image , I want to render it on my jsp page . I am making ajax call to get the image.

$.ajax({
            type: "GET",
            cache: false,
            async: false,
            url: '<spring:url value="/service/org/flk/2"/>',
            success: function(msg) {
jmj
  • 237,923
  • 42
  • 401
  • 438
user1844840
  • 1,937
  • 3
  • 16
  • 13

1 Answers1

1

You will need to stream base64 encoded data in response and then you can do it like

$("#someDivId").html('<img src="data:image/png;base64,'+response + '"/>');

where response is the base64 encoded image data

jmj
  • 237,923
  • 42
  • 401
  • 438
  • my service returns the bytearray , do you mean to assign response which I get from service to attach it to above string – user1844840 Dec 19 '12 at 05:47