Fetch() method in new generation Javascript:

We all are familiar with calling of HTTP based service in web development.So when it comes to HTTP request inside your Javascript we have multiple options like xmlhttp request or third party like axios and more recently we can use the fetch() method of new generation Javascript .Lets see how to implement fetch method in calling a webAPI.

Johnny Bravo Blank Template - Imgflip

To implement this fetch() we will be using API build in node.js https://apidemonodejs.herokuapp.com/skills

you can find the code base for the nodeAPI in my github repo https://github.com/VikasWilliam/Node-API

Lets see how to implement Fetch() method and get the JSON response from the API:

74+] Johnny Bravo Wallpaper on WallpaperSafari

To use fetch we need to provide the API link as an argument:


fetch is basically a promise based method.Promise basically refers to an asynchronous computation which has not competed yet.For promise we use .then for access to the response and .json() to get it in json format as below:

.then((response)=>{      return response.json();    })

Further the promis can be resolved by using another .then method and the response can be logged in the browser console:

.then((data=>{        console.log(data);    }))

the full code is as below:

This code needs to be pasted in the console to get the response on console of the browser.As below:

Extension Icon

Note: Make sure CORS-Cross origin resource sharing is enabled in your browser. you can use “Allow CORS: Access-Control-Allow-Origin” plugin in your chrome browser.

Johnny Bravo – Logos Download

THANKS. Have a great year ahead!!!!!!!

Like share and leave comment if you feel like 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Interesting Literature

A Library of Literary Interestingness


A daily selection of the best content published on WordPress, collected for you by humans who love to read.

The Daily Post

The Art and Craft of Blogging

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.

<span>%d</span> bloggers like this: