title: how to print all elements of json with js
body: <p>I need to create a card element for each row of the database. The problem in my function is that print only the first element. What i forgot? (the query works)</p>
  
  <pre><code>aggiornaEventi();
  
  function aggiornaEventi() {
      fetch("../user_area/query/select_allevents.php").then(onResponse).then(onJson);
  }
  
  function onResponse(response) {
      return response.json();
  }
  
  function onJson(json) {
  
      console.log(json);
  
      if (json.length !== 0) {
          const eventi = document.getElementById("eventi"); //inserire l'id
  
          for (const evento of json) {
  
              const card = document.getElementById("eventi").innerHTML = `
              &lt;div class="card" style="width: 18rem;"&gt;
                  &lt;div class="card-body"&gt;
                      &lt;h5 class="card-title"&gt;${evento.titolo}&lt;/h5&gt;
                      &lt;p class="card-text"&gt;${evento.descrizione} | ${evento.data}&lt;/p&gt;
                      &lt;a href="${evento.link}" class="btn btn-primary"&gt;Vai&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
             `;;
  
  
              eventi.appendChild(card);
  
  
  
  
          }
      }
  }
  </code></pre>