2024-11-08 11:41:12 +00:00
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
2024-11-08 12:45:00 +00:00
|
|
|
const fuelType= document.getElementById('fuel-type');
|
2024-11-08 11:41:12 +00:00
|
|
|
|
|
|
|
let usersData = [];
|
|
|
|
|
2024-11-08 12:45:00 +00:00
|
|
|
// imieSelect.addEventListener('focus', function() {
|
|
|
|
|
|
|
|
fetch('php/gget.php')
|
2024-11-08 11:41:12 +00:00
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
2024-11-08 12:45:00 +00:00
|
|
|
|
|
|
|
data.forEach(row => {
|
|
|
|
|
|
|
|
|
|
|
|
const option = document.createElement('option');
|
|
|
|
option.value = row["nazwa"];
|
|
|
|
//option.textContent = dane.imie + " " + dane.nazwisko;
|
|
|
|
fuelType.appendChild(option);
|
|
|
|
option.textContent = row["nazwa"];
|
|
|
|
console.log (row)
|
|
|
|
});
|
2024-11-08 11:41:12 +00:00
|
|
|
/*
|
|
|
|
usersData = data;
|
|
|
|
imieSelect.innerHTML = "";
|
|
|
|
data.forEach(dane => {
|
|
|
|
const option = document.createElement('option');
|
|
|
|
option.value = dane.id;
|
|
|
|
option.textContent = dane.imie + " " + dane.nazwisko;
|
|
|
|
imieSelect.appendChild(option);
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
|
2024-11-08 12:45:00 +00:00
|
|
|
console.log(data);
|
2024-11-08 11:41:12 +00:00
|
|
|
})
|
|
|
|
.catch(error => console.error('Error fetching data:', error));
|
|
|
|
/*
|
|
|
|
imieSelect.addEventListener('change', function() {
|
|
|
|
const selectedId = imieSelect.value;
|
|
|
|
const selectedPerson = usersData.find(dane => dane.id == selectedId);
|
|
|
|
if (selectedPerson && selectedPerson.photo) {
|
|
|
|
photoDisplay.src = 'data:image/jpeg;base64,' + selectedPerson.photo;
|
|
|
|
} else {
|
|
|
|
photoDisplay.src = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
});
|