所以我的代碼是調用我的服務器上的文件「zom3.ms3d」,我已經確認在那裏,你也可以,以及所有的源代碼。 (http://www.pso2u.com)XMLHttpRequest不斷回來空
這是有問題的代碼:
function getMs3dModel(model, name){
var xhr = new XMLHttpRequest();
xhr.open('GET', name, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
parseBinFile(model, name, this.response);
};
xhr.send();
}
而這正是它打印的內容(或前10個字節的話)
function parseBinFile(model, name, buffer){
var headerStr = new DataView(buffer, 0, 10);
console.log(headerStr);
}
爲什麼我的請求返回null?
你使用什麼瀏覽器?在Mac上運行Safari,響應是一個長度爲99113字節的數組緩衝區。這聽起來像你實際期待的。 – andypaxo
使用firefox 15.0a2:< – CyanPrime