async function populate(){
const nft = await Moralis.Web3API.account.getNFTs({chain: 'matic'});
return buildTableNFT(nft);
}
async function buildTableNFT({result}) {
document.getElementById("resultNFT").innerHTML = `
<table class="table table-dark table-striped" id="nftTable">
</table>
`;
const table = document.getElementById("nftTable");
const rowHeader = `
<thead>
<tr>
<th>ID</th>
<th>Type</th>
<th>Contract</th>
<th>Image</th>
</tr>
</thead>
`;
table.innerHTML += rowHeader;
for (let i = 0; i < result.length; i++) {
let url = result[i].token_uri;
const response = await fetch(url);
const data = await response.json();
const image = data.image;
console.log(image)
const row = `
<tr>
<td>${result[i].token_id}</td>
<td>${result[i].contract_type}</td>
<td><h4>${result[i].token_address}</h4></td>
<td><img src="${image}"></td>
</tr>
`;
table.innerHTML += row;
}
}
I have this code and I get the url of the image in the console but for some reason it wont show on my site.
please help anyone