What the Fetch

Brian Greig on July 21, 2018

This fetch API is pretty nifty. If you have worked with JavaScript's XMLHttpRequests in the past or if you had to rely on libraries like jQuery ... [Read Full]
markdown guide
 

Awesome write up! Thanks for laying out some clear examples. Bookmarking this for everytime I want to make an api call and can't remember exactly what the syntax is. :)

In case anyone's interested, the support for fetch is actually pretty good! Opera Mini and IE11 are the only browsers that need a polyfill.

 

Good catch. Depending on your audience that is pretty decent coverage.

 

you might change the parameter 'e' to url in getData and postData, otherwise you will only use the 'url' from the outer scope.

other then that the methods are very handy and can help to write cleaner code.

thanks for sharing

 

Good eye. I completely missed that because the code executed using the globally scoped variable. It is fixed now. Thanks.

 
 

Hi! Thanks for the good article. I wonder tho if you already have a method postData which does PUT what will happen when you'll need a method which actually does POST.
Have a nice day! :)

code of conduct - report abuse