小编dev*_*101的帖子

Ajax二进制响应

嗨,我想知道是否还有在AJAX中流式传输二进制响应?这将是一个终极解决方案,否则我需要将二进制映像实现为文件,然后使用不同的URL将该文件流式传输给用户.

new Ajax.Request('/viewImage?id=123', {
  // request returns a binary image inputstream
  onSuccess: function(transport) {
      // text example
      // alert(transport.responseText)

      // QUESTION: is there a streaming binary response?
      $('imgElem').src = transport.responseBinary;
  },
  onFailure: function(transport) {
      // handle failure
  }
});
Run Code Online (Sandbox Code Playgroud)

javascript ajax prototypejs

13
推荐指数
3
解决办法
2万
查看次数

标签 统计

ajax ×1

javascript ×1

prototypejs ×1