This workshop will be retired on August 31, 2026.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Working with the Fetch API!
You have completed Working with the Fetch API!
Preview
Let's get started by writing a basic fetch request using the global fetch() method. Then we'll use JavaScript promises to handle the results returned from the server.
Code Snippets
fetch('https://dog.ceo/api/breeds/image/random')
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
workspace, you should see
an index.html file and a js
0:00
folder containing a file named app.js,
the two main files we'll be working with.
0:04
When you preview index.html in the browser
you'll see an empty select menu and
0:09
div container, and
below them a simple form.
0:15
Over in app.js,
there are three pre-written variables.
0:18
It's selecting elements from index.html
like the select menu, card div and form.
0:23
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up