Ajax Binary Response

前端 未结 4 953
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 08:04

Hi I\'m wondering if there\'s anyway to stream a binary response in AJAX? This would be an ultimate solution otherwise I would need to realize the binary image to a file th

4条回答
  •  清歌不尽
    2020-11-30 08:41

    You can send any response you want, being it plain text, HTML, an image... whatever! It's up to you how to handle it when you receive it.

    But... you cannot assign a binary image to the src attribute. You'd better just return the URL to the image and assign that instead - well, to be honest, there are some encodings to embed images in the SRC, but they are not cross-browser so you'll want to stay away from them.

提交回复
热议问题