-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetAmmo.js
More file actions
21 lines (20 loc) · 761 Bytes
/
getAmmo.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 ammo data from the API
fetch('/api/ammo')
.then(response => response.json())
.then(data => {
// Get the ammo dropdown element
const ammoDropdown = document.getElementById('ammoDropdown');
// Populate the ammo dropdown menu with options
data.forEach(ammo => {
const option = document.createElement('option');
option.value = ammo;
option.textContent = ammo;
ammoDropdown.appendChild(option);
});
})
.catch(error => {
console.error('Error fetching ammo data:', error);
// Handle errors if needed
});
});