嗨,我想知道是否还有在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)