From 06d9575d85318f38073be0b752e85462181a9f78 Mon Sep 17 00:00:00 2001 From: William Noris Date: Tue, 19 Oct 2021 12:18:53 +0200 Subject: [PATCH] =?UTF-8?q?r=C3=A9cup=C3=A9ration=20des=20infos=20et=20aff?= =?UTF-8?q?ichage=20moche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/planets.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/scripts/planets.js b/scripts/planets.js index 8a6227c..40463ca 100644 --- a/scripts/planets.js +++ b/scripts/planets.js @@ -6,6 +6,8 @@ console.log('planet.js loaded'); function remplissage(results){ + planetes.innerHTML = ""; + const previousUrl = results.previous; const nextUrl = results.next; const tabResults = results.results; @@ -17,7 +19,7 @@ function remplissage(results){ const terrain = resultPlanet.terrain; const population = resultPlanet.population; - const tabResidents = resultPLanet.residents; + const tabResidents = resultPlanet.residents; //Problème de requêtes asyncrones // let tabResidents = []; // for(index in resultPlanet.residents){ @@ -29,18 +31,24 @@ function remplissage(results){ // console.log(`nom des résidents : ${tabResidents}`); const tabFilms = resultPlanet.films; + + planetes.innerHTML += + `
+

${nom}

+
+
+

${terrain}

+

${climate}

+

${diametre}Km

+
+
${tabResidents}
+
${tabFilms}
+
+
`; } + //Pagination - planetes.innerHTML = - `
-

-
-
Prout 1
-
Prout 2
-
Prout 3
-
-
`; } api_call(API_URL + "/planets", remplissage); \ No newline at end of file