Fetch is a promise based HTTP request API. It’s fairly well supported (87%+ https://caniuse.com/#feat=fetch) and is promise based for ease of use and is a perfect fit for those wanting to use out of the box solutions for HTTP.
For more information, check out the MDN documentation on how to use Fetch within your project(s): https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
https://caniuse.com/#feat=fetch
Chat with me, join the Slack group! http://bit.ly/JoinPaulHallidaySlack
I have courses related to Angular, Ionic, Fuse, Firebase and much more at: https://paulhalliday.io
My NativeScript courses can be found at:
https://nativescripting.com/course/nativescript-with-angular-web-application-conversion
https://nativescripting.com/course/nativescript-with-@ngrx
I also have an Ionic book:
https://leanpub.com/30daysofionicframework
Prefer written content or want a text version of the videos? Check out
my blog: https://blog.paulhalliday.io
Support the content with at least $1 for EXCLUSIVE early access to the next video(s), as well as other benefits! https://www.patreon.com/PaulHalliday
You can also support the content by keeping me caffeinated (much appreciated!): http://paypal.me/PWHSoftware
The extra epic content always comes via email first. Sign up so you’re not left behind: http://eepurl.com/cBCqO9
You can also find me:
https://www.facebook.com/PaulHalliday.io
http://twitter.com/PWHSoftware
http://linkedin.com/in/paulhal
Original source
31 responses to “How to use Fetch with JavaScript”
There is so much missing information in this.
Where do you put this code?
Do you put it in server.js where express is?
How do you fetch data from an API?
What if the API requires a key? How do you input a key?
If the URL you're fetching from requires the content of the form, how do you get the values from the form to be included in the URL in the fetch in the first place?
you need to explain more !!
I use StackBlitz, it is ok?
Hi Paul. Thank you for a tutorial about Fetch with JS. One question: It means that I can create own post, then to make a request to use it in my app, correct? So, where data will be stored? Also, I would like to use some own images for the data request, is it possible, please explain how to add images as well. Thank you in advance.
So easy to undestand. Huge thanks to the author
I can do it with blogger api?
If may I ask what color theme is that?
where's the like button!!!!!
hi do you have codes for edit function? thanks
This video saved me so much time! You're a lifesaver! Keep up the great work!
can i know the theme name Paul ?
Can I ask how did you auto add the code inside the curly braces at 1:03?
Thank you sooo much, really appreciate it.
thanks. Maybe you should remind new programmers about the best practices you are using. Thanks
Stop trying to make fetch happen. It's not going to happen!
I'm getting fetch is not defined error
Amazing video, but these curly braces are really weird.
thanks
const newPost it's confusing imho!
could i uset the getpost() with a search box to show data from the backend to the frontend ?
What's that font you are using? Looks neat!
Better to use async await.
You didn't explain how you connected to http://localhost:8080? When you go to the console it's somehow connected?
amazing, I like ur vue.js videos
Nice keep it up
would love a complimentary video to axios
Hi paul, thanks for the tutor ! 😉 if its not bother you, can i ask you about making a video about an introduction to OAuth 2.0 and using fetch to get an access token ? Ive been stumbling with this oauth system. Thank you so much before paul
Thanks! What editor and theme are you using?
What's theme are you using and nice vid!
https://github.com/Solido/awesome-flutter
Hey Paul ! how Flutter are you ? 😉