I've to make POST request to an API and this API returns an image which I want to show on canvas or img element. The problem is weird characters are coming in response but in network tab, image is shown properly(screenshots below)
I've tried everything mentioned in AJAX - Weird characters in img tag after request response
I've tried to convert to base64
, load using new Image()
, tried to convert to blob, load using FileReader()
, but blank image is loaded.
Instead of POST request, if I use some static image URL with new Image()
or FileReader()
, it works without issues. How do I render an image that comes as a response from POST request? Any help is appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…