0

I want to get image from ajax, but i get result unicode. but in inspect network result my image display. I get result like this

����JFIFHH��C↵↵↵

How to display image from unicode like this?

this is my ajax code

$.ajax({
        url: urlpath,
        headers: {
            authorization: `Bearer ${localStorage.getItem(access_token)}`,
        },
        method: "GET",
        dataType: "text",
        success: function(response, status, xhr) {
            $(".img-profile-report").attr("src", `data:image/png;base64,${hexToBase64(response)}`);
            console.log(response);
            console.log('aaa')
        },
        error: function(response, status, xhr) {
            console.log('bbb');
            console.log(response);
            // localStorage.clear();
            // window.location = "/login";
        },
    });
Tama BM
  • 1
  • 1

0 Answers0