Use fetch instead of XmlHttpRequest in Javascript
Making a fetch call only takes two lines of code:
res = await fetch("https://coderwall.com", { method: "GET" });
await res.text()
Mailer To Go is an email provider on Heroku that is by developers for developers.
We've spend too much time dealing with other mailing services, and decided to create our own.
Written by Lex S
Related protips
2 Responses
Thanks for sharing, Lex. Agree, fetch simplifies things compared to XMLHttpRequest. Curious if you’ve run into any edge cases where fetch didn’t behave as expected?
over 1 year ago
·
This is great!
7 months ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Browser
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#