Commit 235b79f5 authored by Mat's avatar Mat

twig, construit le tableau d'affichage, en javascript

parent 007a8205
......@@ -11,8 +11,6 @@
</tr>
</thead>
<tbody>
</tbody>
</table>
{% endblock %}
......@@ -34,7 +32,26 @@
console.log(this);
if (this.readyState === 4
&& (this.status === 200 || this.status === 0)) {
let json = JSON.parse(this.responseText);
for (let i = 0; i < json.length; i++)
{
let tr = document.createElement('tr');
let td1 = document.createElement('td');
td1.textContent = json[i].firstname;
tr.appendChild(td1);
let td2 = document.createElement('td');
td2.textContent = json[i].lastname;
tr.appendChild(td2);
let td3 = document.createElement('td');
td3.textContent = json[i].created_at;
tr.appendChild(td3);
let td4 = document.createElement('td');
td4.textContent = json[i].modify_at;
tr.appendChild(td4);
}
console.log(json);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment