I am building a webpage that fetches data from NASA Picture of the day API and displays it on my webpage. I am able to fetch data for the current date or any specific date. But I want to display the image and description for today and then the following dates as the NASA site updates. I am not sure how to display multiple images for different dates on my webpage using Javascript. Following is the script code that I implemented:
async function getData(){
const response = await fetch(api_url);
const data = await response.json();
document.getElementById("imageTitle").innerHTML= data.title;
document.getElementById("description").innerHTML= data.explanation;
document.getElementById("potd").src= data.hdurl;
document.getElementById("datePosted").innerHTML= data.date;
document.getElementById("credits").innerHTML=data.copyright;
}
getData();