用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("上传成功"); }
慕无忌1623718
相关分类