Tag Archive for: fetch

Asynchronous fetch with first class functions and closures

Get and post with/without authorization needed

Asynchronous fetch

Using fetch with asyncronous functions.

This way is even cleaner than using fetch by its own, check this out!

Google Maps clusterization

We are going to fetch flights data to create our makers. Do not set the map in each marker, the clusterization will set it up instead.

Post JSON data to an URL

The easiest way to do a POST in JavaScript: using fetch.

Get JSON data from an URL

AJAX request using ES6 Promises with fetch and XMLHttpRequest. Notice that the url needs https because we request from https and the server should allow all origins (Access-Control-Allow-Origin: *)

Fetch is simpler and cleaner, it avoid callback hell and having to remember the complex API of XMLHttpRequest.