I want to show ajax URL data shows into the HTML table, and I don't know why it shows me undefined help me I couldn't find out the error
$.ajax({
url: 'https://api.thevirustracker.com/free-api?countryTotals=ALL',
dataType: 'json',
success: function(data) {
for (let i = 0, n = data.countryitems.length; i < n; i++) {
const entries = data.countryitems[i]
Object.keys(entries).forEach(key => {
console.log(key, entries[key])
document.getElementById('table').innerHTML =
`<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Country Name</th>
<th scope="col">Infected</th>
<th scope="col">Recovered</th>
<th scope="col">Unresolved</th>
<th scope="col">Deaths</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">${key,entries[key].ourid}</th>
<td>${key,entries[key].title}</td>
<td>${key,entries[key].total_cases}</td>
<td>${key,entries[key].total_recovered}</td>
<td>${key,entries[key].total_unresolved}</td>
<td>${key,entries[key].total_deaths}</td>
</tr>
</tbody>
</table>`
});
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="row">
<div class="col" id="table"></div>
</div>
but it shows me undefined
</div>