From 42ed96298b65cf867fbf01ee6e5bff4eae93a60e Mon Sep 17 00:00:00 2001 From: SandeepKumar1995 <54086388+SandeepKumar1995@users.noreply.github.com> Date: Sat, 10 Apr 2021 00:19:06 -0400 Subject: [PATCH 1/2] Update index.html --- index.html | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index c69204f..8050809 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,17 @@ - - - - Astronauts - - - - -

Astronauts

-
- -
- - \ No newline at end of file + + + + Astronauts + + + + +

Astronauts

+

+
+ +
+ + From a25c4f8708a078b88a6a215cdb2eca52961825b9 Mon Sep 17 00:00:00 2001 From: SandeepKumar1995 <54086388+SandeepKumar1995@users.noreply.github.com> Date: Sat, 10 Apr 2021 00:20:32 -0400 Subject: [PATCH 2/2] Update script.js --- script.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 9417030..65f5593 100644 --- a/script.js +++ b/script.js @@ -1 +1,32 @@ -// TODO: add code here \ No newline at end of file +// TODO: add code here +window.addEventListener("load",function(){ + fetch("https://handlers.education.launchcode.org/static/astronauts.json").then(function(response){ + console.log(response) + response.json().then(function(json){ + console.log(json); + let astronauts = ""; + let counter = 0; + let container = document.getElementById("container"); + for(astronaut of json){ + console.log(astronaut); + astronauts +=`
+
+

${astronaut.firstName} ${astronaut.lastName}

+ +
+ +
` + counter++ + } + let count = document.getElementById("count"); + count.innerHTML = `

Count: ${counter}

` + container.innerHTML = astronauts; + }) + + }) +})