Last Updated: October 23, 2026
·
81.75K
· Lex S

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.

2 Responses
Add your response

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
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