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.
When I loaded this page I was literally thinking "if there isn't a comment from Mean Girls"...!
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! :)
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.