-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
28 lines (24 loc) · 957 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// script.js
// Fetch the CSV file (adjust the path as needed)
fetch('angry.csv')
.then(response => response.text())
.then(csvData => {
const rows = csvData.split('\n');
const tableBody = document.querySelector('#songTable tbody');
rows.forEach(row => {
const columns = row.split(',');
if (columns.length === 5) {
const [Name, Album, Artist, Link, Image] = columns;
const newRow = document.createElement('tr');
newRow.innerHTML = `
<td>${Name}</td>
<td>${Album}</td>
<td>${Artist}</td>
<td><a href="${Link}" target="_blank">Listen</a></td>
<td><img src="${Image}" alt="${Name}"></td>
`;
tableBody.appendChild(newRow);
}
});
})
.catch(error => console.error('Error fetching CSV:', error));