Skip to content

XHR #22

@heikaimu

Description

@heikaimu
const xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
xhr.onreadystatechange = () => {
 if (xhr.readyState === 4) {
  if (xhr.status === 200) {
   console.log("成功");
  } else {
   console.log("上传失败", xhr);
  }
 }
};
xhr.setRequestHeader("Content-type", file.type);
xhr.send(file);

https://www.jianshu.com/p/918c63045bc3
https://www.cnblogs.com/52fhy/p/5436673.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions