Orientacyjny koszt paliwa

-
- - - - - - - -
+ +
+ + + + + + + + +
+
Car diff --git a/js/script.js b/js/script.js index 091b31a..eb412db 100644 --- a/js/script.js +++ b/js/script.js @@ -1,13 +1,25 @@ document.addEventListener('DOMContentLoaded', function() { - //const imieSelect = document.getElementById('imie'); + const fuelType= document.getElementById('fuel-type'); let usersData = []; - imieSelect.addEventListener('focus', function() { - fetch('get.php') + // imieSelect.addEventListener('focus', function() { + + fetch('php/gget.php') .then(response => response.json()) .then(data => { + + 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) + }); /* usersData = data; imieSelect.innerHTML = ""; @@ -19,9 +31,9 @@ document.addEventListener('DOMContentLoaded', function() { }); */ + console.log(data); }) .catch(error => console.error('Error fetching data:', error)); - }); /* imieSelect.addEventListener('change', function() { const selectedId = imieSelect.value;