forked from data-students/AEDChallenge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathequipos.html
62 lines (56 loc) · 2.4 KB
/
equipos.html
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Team Recommendations</title>
<!-- Previous styles remain the same -->
</head>
<body>
<div id="particles-js"></div>
<nav class="navbar">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/datos">Register</a></li>
</ul>
</nav>
<h1>Recommended Team Members</h1>
<div class="recommendation-container">
<!-- Cards will be loaded here -->
</div>
<script>
document.addEventListener('DOMContentLoaded', async () => {
console.log('DOM loaded, fetching candidates...');
try {
// Update fetch path to root directory where perfiles.json is created
const response = await fetch('/perfiles.json');
console.log('JSON response:', response);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const perfilesData = await response.json();
console.log('Profiles loaded:', perfilesData);
const container = document.querySelector('.recommendation-container');
perfilesData.forEach((perfil, index) => {
const card = document.createElement('div');
card.className = 'recommendation-card';
card.innerHTML = `
<h2>${perfil[0] || 'Unknown'}</h2>
<p class="age"><strong>Age:</strong> ${perfil[1] || 'N/A'}</p>
<button class="reject-btn">Reject</button>
<p class="intro">${perfil[2] || 'No introduction available.'}</p>
`;
card.querySelector('.reject-btn').addEventListener('click', () => {
card.remove();
});
container.appendChild(card);
});
} catch (error) {
console.error('Error loading profiles:', error);
document.querySelector('.recommendation-container').innerHTML =
'<p>Error loading recommendations. Please try again later.</p>';
}
});
</script>
</body>
</html>