Javascript 与HTTPRequest的响应有关的问题
所以,我试图从HTTP请求中获取字节。 我确实做了Javascript 与HTTPRequest的响应有关的问题,javascript,xmlhttprequest,Javascript,Xmlhttprequest,所以,我试图从HTTP请求中获取字节。 我确实做了responseType=arraybuffer,我想接收这个数组 this._xhr.onreadystatechange = function() { if($this._xhr.readyState == 4) { if($this.successStatus.contains($this._xhr.status) &&
responseType=arraybuffer
,我想接收这个数组
this._xhr.onreadystatechange = function()
{
if($this._xhr.readyState == 4)
{
if($this.successStatus.contains($this._xhr.status) && typeof($this.succeed) == "function")
{
console.warn($this._xhr); //LOG 1
console.warn($this._xhr.response); // LOG 2
debugger;
if($this.responseType == "" || $this.responseType == "text")
$this.succeed($this.raw ? $this._xhr.responseText : JSON.parse($this._xhr.responseText));
else
$this.succeed($this._xhr.response);
}
}
}
所以我使用这段代码,我想调用函数this.successful,给出我想要的参数
$this.succeed($this._xhr.response);
问题是,在控制台上我有
我做错了什么 您正在假设
console.warn()
输出告诉您什么。我不认为缓冲区是空的,我也这么认为。hx