1 var formData = new FormData();
 2 formData.append('file', $('#file').get(0).files[0] );
 3 $.ajax({
 4     url: 'ajax/upload',
 5     type: 'post',
 6     data: formData,
 7     dataType: 'json',
 8     processData: false, //重要
 9     contentType: false, //重要
10     success: function (d) {
11     console.log(d);
12     },
13   error: function(err){
14     console.log(err);
15   }
16 })

 


posted on 2017-08-25 17:35  _linka  阅读(386)  评论(0编辑  收藏  举报