38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
//const imieSelect = document.getElementById('imie');
|
|
|
|
let usersData = [];
|
|
|
|
imieSelect.addEventListener('focus', function() {
|
|
fetch('php/gget.php')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
/*
|
|
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);
|
|
});
|
|
*/
|
|
|
|
console.log(data);
|
|
})
|
|
.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 = '';
|
|
}
|
|
});
|
|
*/
|
|
});
|