jquery ajax 文件上传配置

东明兄 2019-01-17
0条评论 1,415 次浏览
东明兄 2019-01-170条评论 1,415 次浏览
   var fd = new FormData;
        fd.append('file', document.getElementById('f').files[0]);
        //console.log(fd.get('file'));
        $.ajax({
            type: 'post',
            url: "http://admin.crazy.com/feedback",
            data: fd,
            processData: false, // 默认 | 不处理数据
            contentType: false, // 默认 | 不设置内容类型
            success: function (res) {
                console.log(res);
                var data = res.data;

            }
        });

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注