前端异步上传图片

JY.Model.editSize("importAuForm","导入",500,function(){

             if(JY.Validate.form("importAuForm")){
                 var that =$(this);

      // var fd = new FormData();
      // fd.append("name", "bill");
      // fd.append("photo", $('#f')[0].files[0]);
      // fd.append("photo2", $('#f')[0].files[1]);
      $.ajax({
         url: jypath +'/backstage/'+pagepath+'/import',
         type: 'post',
         cache: false,
         processData: false,
         contentType: false,
         data: new FormData($('#importAuForm')[0]),

      }).done(function(res) {
                     that.dialog("close");
                     JY.Model.info(JSON.parse(res).resMsg,function(){search();});
      }).fail(function(res) {
                     that.dialog("close");

                     JY.Model.info("导入失败",function(){});

      });


   }
});

猜你喜欢

转载自blog.csdn.net/huangpeigui/article/details/80191923
今日推荐