ajax 文件上传添加上传监听报跨域

    var fd = new FormData()
    fd.append('file',blob)
    xhr=new XMLHttpRequest()
    xhr.open('post','url',true)
    xhr.onreadystatechange=function(){
        if (xhr.readyState==4){
           console.log(xhr.responseText)
        }
    }
    xhr.upload.onprogress = function(e) {
        console.log(e)
    }
    xhr.send(fd)

我把上传监听事件去掉就可以正常上传,但是加上后浏览器就会报跨域这是怎么回事啊

阅读 1.6k
推荐问题