AnoTest

ApiObjects

Nov 30th, 2021 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.84 KB | None | 0 0
  1.  
  2.     <input type="submit" name=""onclick='Test()' id="">
  3.  
  4.     <div id="listDate">
  5.  
  6.     </div>
  7.     <script>
  8.  
  9.  
  10. const Test = async()=> {
  11.         console.log('hello');
  12.         let request = new XMLHttpRequest();
  13.         const res = await fetch('https://calendrier.api.gouv.fr/jours-feries/metropole.json');
  14.         testJson = await res.json();
  15.         console.log(testJson);
  16.         let contenuTest =  document.getElementById("listDate");
  17.         let contenu;
  18.         for( var json in testJson){
  19.             var testKey = testJson[json];
  20.             // console.log(testKey);
  21.             // console.log(json);
  22.             contenu += testKey;
  23.             contenu += '<br>';
  24.             contenu += json;
  25.             contenu += '<br>';
  26.             console.log(json);
  27.         }
  28.  
  29.        
  30.         contenuTest.innerHTML = contenu;
  31.  
  32.     // });
  33. }
Add Comment
Please, Sign In to add comment