I have this code here
for (let i=0; i < data.length; i++){
console.log(data[i].token_uri)
let row = `<tr>
<td>${data[i].token_id}</td>
<td>${data[i].contract_type}</td>
<td><h4>${data[i].token_address}</h4></td>
<td>${data[i].token_uri}</td>
</tr>`
table.innerHTML += row
}
when I run it I get back the token-uri of an nft which is what I want however the token-uri doesnt contain the image
when doing
console.log(data[i].token_uri)
this is the urls I get back for example:
https://ipfs.moralis.io:2053/ipfs/bafkreic47njf53ueqgsrtuqh4jtqzcxfheiifilnypfjckvqtyiwefjr2y
but now I need to access this url because the actual image is here:
{"name": "Elon Weed", "description": "Elon Musk smokes weed on Joe Rogan", "image": "https://preview.redd.it/0hkeya69rx421.jpg?width=779&format=pjpg&auto=webp&s=1b562656f081d8424e09c7eca6373f8b78891428", "properties": {"level": "2"}}
and in my table I would like to only display the actual image
https://preview.redd.it/0hkeya69rx421.jpg
how can I get this data and than display it in my table?
This is the code I tried so far:
async function populate(){
const nft = await Moralis.Web3API.account.getNFTs({chain: 'matic'}).then(buildTableNFT);
}
function buildTableNFT(_data){
let data = _data.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 < data.length; i++){
console.log(data[i].token_uri)
let row = `<tr>
<td>${data[i].token_id}</td>
<td>${data[i].contract_type}</td>
<td><h4>${data[i].token_address}</h4></td>
<td>${data[i].token_uri}</td>
</tr>`
table.innerHTML += row
}
}