FormData ajax

var fd=new FormData();
        fd.append('userId',userid);
        fd.append('starName',name);
        fd.append('starType',1);
        fd.append('fileType',0);  
        fd.append('weibo',weibo);
        fd.append('weixin',weixin);

        fd.append('files',$("#file1")[0].files[0])

$.ajax({
        url:url+"star/add",
        data:fd,
        type:'post',
        cache: false,

processData: false,  // 告诉jQuery不要去处理发送的数据

  contentType: false,   // 告诉jQuery不要去设置Content-Type请求头  
  success:function(res){
  console.log(res);
  alert('添加成功');
  location.href='default.html'
  },error:function(err){
  throw err;
  }
})

    crossDomain: true, // 如果用到跨域,需要后台开启CORS



uploadify:

$("#uploadify").uploadify({
  'debug':true,
           'uploader': 'uploadify/uploadify.swf',
           'script':url+'profile',
           'scriptData':{starId:starid,type:typeid},
           'cancelImg': 'uploadify/cancel.png',
           'fileExt': exs[typeid],
           'fileDesc': 'Image Files',
           'fileDataName':'file',
           'auto': false,           //自动上传
           'multi': multi[typeid],         //多文件上传
           'sizeLimit': nums[typeid],      //上传大小
           'fileCount': counts[typeid],
           'onComplete':function(event, queueID, fileObj, response, data){
            console.log(response);
            //location.reload();
            temp();
           }
       });


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值