javascript - jquery ajax 报错
高洛峰
高洛峰 2017-04-10 15:26:35
0
3
282

在学一个粘贴上传的小例子,发现ajax部分会报这样的错误

求解!

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

全部回覆(3)
伊谢尔伦

不合法的調用

In your code you are assigning a native method to a property of custom object. When you call support.animationFrame(function () {}) , it is executed in the context of current object (ie support). For the native requestAnimationFrame function to work properly, it must be executed in the context of window

http://stackoverflow.com/questions/9677985/uncaught-typeerror-illegal-...

故查下所有的 native 函數賦值,加上一個 bind 即可。

刘奇

看看在哪一行报错。

小葫芦
php//使用FormData 供参考
function uploadfile(){
    var fd = new FormData();
    fd.append("file", document.getElementById('file').files[0]);
    var xhr = new XMLHttpRequest();
    xhr.upload.addEventListener("progress", uploadProgress, false);
    xhr.open("POST", "/upload");
    xhr.send(fd);
}
function uploadProgress(){
//
}
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板