From 94a23737497603b0c2821780ac47654fe3a59517 Mon Sep 17 00:00:00 2001 From: horville Date: Sun, 26 Mar 2023 23:20:16 +0200 Subject: [PATCH] modif index --- index.html | 7 +++--- javascript/testformation.js | 45 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 javascript/testformation.js diff --git a/index.html b/index.html index f00be26..43c58ed 100644 --- a/index.html +++ b/index.html @@ -7,14 +7,13 @@ - + - - --> diff --git a/javascript/testformation.js b/javascript/testformation.js new file mode 100644 index 0000000..475dc51 --- /dev/null +++ b/javascript/testformation.js @@ -0,0 +1,45 @@ +async function formation() { + let result = await fetch("https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&sort=tri&facet=fili&timezone=Europe%2FBerlin"); + let resultats = await result.json(); + console.log(result); + console.log(resultats); + let table = resultats["facet_groups"][0]["facets"]; + console.log(table); + const tableBody = document.querySelector("tbody1"); + for (tes of table) { + const tableRow = document.createElement("tr"); + const formationCell = document.createElement("td"); + let texteformation = document.createTextNode(tes.name); + formationCell.appendChild(texteformation); + tableRow.appendChild(formationCell); + const nombredeplaceCell = document.createElement("td"); + const nombredeplace = document.createTextNode(tes.count); + nombredeplaceCell.appendChild(nombredeplace); + tableRow.appendChild(nombredeplaceCell); + tableBody.appendChild(tableRow); + } +} +var testformation = { + css: null, + exports: { + onMounted() { + formation(); + } + }, + template: (template, expressionTypes, bindingTypes, getComponent) => template('
', [{ + type: bindingTypes.TAG, + getComponent: getComponent, + evaluate: _scope => 'tbody1', + slots: [{ + id: 'default', + html: '', + bindings: [] + }], + attributes: [], + redundantAttribute: 'expr4', + selector: '[expr4]' + }]), + name: 'formation' +}; + +export { testformation as default };