File "code002.html"

Full Path: /home/analogde/www/Diabete/Provisoire/code002.html
File size: 1.19 KB
MIME-type: text/html
Charset: utf-8

<!DOCTYPE html>
<html lang="fr">
<head>
  <meta charset="UTF-8">
  <title>Page 2 - Réception</title>
  <style>
    table {
      border-collapse: collapse;
      width: 60%;
      margin: 20px auto;
    }
    th, td {
      border: 1px solid #999;
      padding: 8px 12px;
      text-align: left;
    }
    th {
      background-color: #f2f2f2;
    }
  </style>
</head>
<body>
  <h2 style="text-align:center">Page 2 : Données reçues</h2>
  <div id="table-container"></div>

  <script>
    function afficherTableau(data) {
      const container = document.getElementById('table-container');
      if (!data || data.length === 0) {
        container.innerHTML = "<p>Aucune donnée reçue.</p>";
        return;
      }

      let html = "<table>";
      html += "<tr><th>ID</th><th>Nom</th><th>Âge</th></tr>";

      data.forEach(item => {
        html += `<tr><td>${item.id}</td><td>${item.nom}</td><td>${item.age}</td></tr>`;
      });

      html += "</table>";
      container.innerHTML = html;
    }

    // Récupération depuis localStorage
    const donneesJSON = localStorage.getItem("donneesUtilisateurs");
    const donnees = JSON.parse(donneesJSON);

    afficherTableau(donnees);
  </script>
</body>
</html>