-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetType.js
More file actions
21 lines (20 loc) · 761 Bytes
/
getType.js
File metadata and controls
21 lines (20 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
document.addEventListener('DOMContentLoaded', () => {
// Fetch type data from the API
fetch('/api/type')
.then(response => response.json())
.then(data => {
// Get the type dropdown element
const typeDropdown = document.getElementById('typeDropdown');
// Populate the type dropdown menu with options
data.forEach(type => {
const option = document.createElement('option');
option.value = type;
option.textContent = type;
typeDropdown.appendChild(option);
});
})
.catch(error => {
console.error('Error fetching type data:', error);
// Handle errors if needed
});
});