And guys!
I have a problem that I can not solve in any way. I've tried a lot and I've not gotten anywhere.
In the company where we work we use proprietary language, which by the way I hate. When I make a request for an image via $.ajax()
(jQuery) the only possible return I have is a string. This string is in binary. From this string I have to generate an image.
For example: if we open an image (jpeg, png or jpg extension) with notepad, what will appear is a lot of characters. If you copy this text, paste in notepad and save as txt, you can change the extension of this file to .jpeg and what before was a text (.txt) flip a picture. Okay ...
That is, the blessed proprietary language of the company where I work sends me these characters / text, but I can not generate an image and display it on the screen.
I read about Blob. According to some posts I found, it is possible to generate an image if I create a Blob object with the characters I received.
I believe it's something with the blob type:
var myBlob = new Blob([response], {type:"text/jpg"});
The following is the ajax request:
$.ajax({
url: url,
method: "POST",
success: function(response){
var myBlob = new Blob([response], {type: "text/jpeg"});
}
});
Does anyone know how to do this?