FormData部分: 先new FormData对象 :let somedata = new FormData(),然后将数据添加进去,这里我们使用append()进行添加. 这里举一个上传头像的例子: let token = localStorage.token; let img = $(".file")..get(0).files[0]; let somedata = new FormData(); somedata.append("token",token)
$('#image').on('change', function () { var url = ""; var form = new FormData(); form.append("file", this.files[0]); var settings = { "url": url, "method": &quo