We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e83dab commit 34ba357Copy full SHA for 34ba357
fetch/fetch_planets.html
@@ -0,0 +1,32 @@
1
+<!DOCTYPE html>
2
+<html>
3
+ <head>
4
+ <title>Fetch Planets</title>
5
+ <script>
6
+ window.addEventListener("load", function() {
7
+
8
+ fetch("https://handlers.education.launchcode.org/static/planets.json").then(function(response) {
9
+ response.json().then(function(json) {
10
+ const destination = document.getElementById("destination");
11
+ let index = 0;
12
+ destination.addEventListener("click", function(){
13
+ destination.innerHTML = `
14
+ <div>
15
+ <h3>Planet ${json[index].name}</h3>
16
+ <img src=${json[index].image} height=250></img>
17
+ </div>
18
+ `;
19
+ index = (index + 1) % json.length;
20
+ });
21
22
+});
23
24
+ </script>
25
+ </head>
26
+ <body>
27
+ <h1>Destination</h1>
28
+ <div id="destination">
29
+ <h3>Planet</h3>
30
31
+ </body>
32
+</html>
0 commit comments