Skip to content

Instantly share code, notes, and snippets.

@tingwei628
Last active August 21, 2022 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tingwei628/4e0ec5a3b6f5bb523f4d3ff034f8135b to your computer and use it in GitHub Desktop.
Save tingwei628/4e0ec5a3b6f5bb523f4d3ff034f8135b to your computer and use it in GitHub Desktop.
abort xhr request
var xhr = new XMLHttpRequest(),
method = "your_api_method",
url = "you_api";
xhr.open(method, url, true);
xhr.send();
setTimeout(() => {
xhr.abort();
}, 1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment