Tip 45 Make Simple AJAX Calls with Fetch

In this tip, you’ll learn how to retrieve remote data using fetch().

If you do any significant JavaScript app development, you’ll have to interact with APIs. With APIs, you can get current information and update single elements without a page refresh. In short, you can create very fast applications that behave like native software.

Single-page web apps are part of the reason why JavaScript is so popular, but getting data with AJAX—Asynchronous JavaScript And XML—used to be a hassle. It was such a hassle that most developers used a library, usually jQuery, to to reduce the complexity. You can see the documentation on the Mozilla Developer Network.[46] It’s not easy stuff.

Now, there’s a ...

Get Simplifying JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.