#1- asynchronous javascript GET request | using fetch in javascript in hindi

by: CODERS NEVER QUIT     Published on: 31 March 2019

Views: 2,361

48    1   

Fast Download

Description :

weather forecasting api used in this video : https://openweathermap.orgThe Fetch API provides a JavaScript interface for accessing and manipulating parts of the HTTP pipeline, such as requests and responses. It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network.This kind of functionality was previously achieved using XMLHttpRequest. Fetch provides a better alternative that can be easily used by other technologies such as Service Workers. Fetch also provides a single logical place to define other HTTP-related concepts such as CORS and extensions to HTTP.A basic fetch request is really simple to set up. Have a look at the following code:fetch('url') .then(function(response) { return response.json(); }) .then(function(res2) { console.log(res2); });#asyncJavascript #fetch #codersneverquit