Guest User

Untitled

a guest
Oct 14th, 2020
47
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getDataJakarta() {
  2.  
  3.     let dataJakarta = "<tr><th>Provinsi</th><th>Positif</th><th>Sembuh</th><th>Meninggal</th></tr>";
  4.  
  5.     fetch('https://indonesia-covid-19.mathdro.id/api/provinsi')
  6.     .then(response => response.json())
  7.     .then(data => {
  8.             dataJakarta += '<tr>'
  9.             dataJakarta += '<td>'+ data.data[0].provinsi + '</td>'
  10.             dataJakarta += '<td>'+ data.data[0].kasusPosi + '</td>'
  11.             dataJakarta += '<td>'+ data.data[0].kasusSemb + '</td>'
  12.             dataJakarta += '<td>'+ data.data[0].kasusMeni + '</td>'
  13.             dataJakarta += '</tr>'
  14.  
  15.         document.getElementById("table-provinsi").innerHTML = Jakarta
  16.     })
  17.     .catch(err => {
  18.         console.log(err)
  19.     });
  20. }
RAW Paste Data