Skip to content

Commit 8693f45

Browse files
author
Edward King
committed
Worked on exercise
1 parent e58ab25 commit 8693f45

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

fetch/exercise/fetch.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Fetch Planet</title>
7+
8+
<script>
9+
window.addEventListener("load", function(){
10+
// TODO: fetch planets JSON
11+
fetch("https://handlers.education.launchcode.org/static/planets.json").then(function(response){
12+
response.json().then(function(json) {
13+
const destination = document.getElementById("destination");
14+
destination.innerHTML = `<h3>Planet ${json[0].name}</h3>`;
15+
})
16+
} )
17+
});
18+
</script>
19+
</head>
20+
<body>
21+
<h1>Destination</h1>
22+
<div id="destination">
23+
<h3>Planet</h3>
24+
</div>
25+
</body>
26+
</html>

0 commit comments

Comments
 (0)