0

so I'm trying to populate a table with some data taken from an api, the problem is that the array that I need to get into the table is inside an object, this is what I get from console.log

console.log

and this is my JS script

$.get("https://api.covid19api.com/summary", function (data) {
  console.log(data)
  $(function () {
    $('#table').bootstrapTable({
      data: data
    });
  });
});

this is the table

<table id="table" data-height="460" data-search="true" data-side-pagination="server" data-pagination="true">
<thead>
<tr>
  <th data-field="Country" data-sortable="true">Country</th>
  <th data-field="NewConfirmed" data-sortable="true">NewConfirmed</th>
  <th data-field="TotalConfirmed" data-sortable="true">TotalConfirmed</th>
  <th data-field="NewDeaths" data-sortable="true">NewDeaths</th>
  <th data-field="TotalDeaths" data-sortable="true">TotalDeaths</th>
  <th data-field="NewRecovered" data-sortable="true">NewRecovered</th>
  <th data-field="TotalRecovered" data-sortable="true">TotalRecovered</th>
</tr>
</thead>

Thanks so much!

Matt
  • 3
  • 1
  • The answer on the last question was working! – Manas Khandelwal Mar 24 '21 at 23:57
  • @ManasKhandelwal yes that was working but with that API url I was getting an array while now I'm getting an array inside an object, that's my issue! Thanks anyway for your help! – Matt Mar 25 '21 at 10:07

0 Answers0