Javascript 使用jquery文件上载跨域文件上载

Javascript 使用jquery文件上载跨域文件上载,javascript,jquery,python,cross-domain,jquery-file-upload,Javascript,Jquery,Python,Cross Domain,Jquery File Upload,我正在使用Blueimp的jQuery文件上传,我需要进行跨域文件上传(从localhost:8008到localhost:8000) 但在最初阶段,我甚至没有得到回应,我得到了这个错误: . 请求的资源上不存在“Access Control Allow Origin”标头。因此不允许访问 jQuery是: $(function () { $('#fileupload').fileupload({ url: 'http://examples.com/multi/multi

我正在使用Blueimp的jQuery文件上传,我需要进行跨域文件上传(从localhost:8008到localhost:8000)

但在最初阶段,我甚至没有得到回应,我得到了这个错误: . 请求的资源上不存在“Access Control Allow Origin”标头。因此不允许访问

jQuery是:

$(function () {
    $('#fileupload').fileupload({
        url: 'http://examples.com/multi/multi/',
        dataType: 'json',
        type: 'post',
        fileInput: $('#fileupload'),
        forceIframeTransport: true,
        multipart: true,
        autoUpload: true,

        done: function (e, data) {
             $.each(data.files, function (index, file) { 
                debugger;
              console.log(file); 
              $.support.cors = true; 
              $.post('examples.com/multi/multi_uploader_details/', 'file_name='+file) 
              .success(function(resp){ 
                  console.log(resp); 
                  if(resp.code == 0){ 
                      $("#file_db_id").val(resp.data.identifier); 
                  } 
                  else{ 
                      alert(resp.data); 
                  } 
              }) 
              .fail(function(){ 
                  alert("error"); 
              }); 
        
    }); 
尝试改变

dataType: 'json',


您可以使用完整的CORS实现:可以找到详细的教程,预计它会更加现代。但是不要期望它在旧浏览器上工作:扩展中是否有一个跨域属性,就像中的.ajax()一样。如果是,请尝试将其设置为true。
dataType: 'jsonp',