My-website/scripts/spotify.js
2024-11-30 12:30:05 -06:00

10 lines
No EOL
424 B
JavaScript

fetch('/spotify-data')
.then(response => response.json())
.then(data => {
const spotifyList = document.getElementById('spotify-list');
data.items.forEach(track => {
const listItem = document.createElement('li');
listItem.textContent = `${track.name} by ${track.artists.map(artist => artist.name).join(', ')}`;
spotifyList.appendChild(listItem);
});
});