用ajax跨域上傳文件不加xhr就能請求成功,為了實現進度條功能在ajax里面加了xhr就報錯了 $.ajax({url: "http://localhost:823/api/FileStream/Upload",type: "post",contentType: false,cache: false,processData: false,contentType: false,data: formdata,xhr:function(){ var myXhr = $.ajaxSettings.xhr(); if (myXhr.upload) { myXhr.upload.addEventListener("progress", progressHandlingFunction,false); } return myXhr; },success: function (text){ if (text == "success") { alert("上傳成功"); }
ajax跨域上傳文件加了xhr報不支持options錯誤
HUWWW
2018-08-13 10:14:17