a1/fetch.js

23 lines
725 B
JavaScript
Raw Normal View History

2024-05-21 07:54:31 +00:00
const url = "http://localhost/dev/get.php"
// const url = "http://qstack.pl:8080/z1/get.php"
2024-05-20 08:32:10 +00:00
let lista
2024-05-15 10:24:25 +00:00
2024-05-20 05:14:55 +00:00
fetch(url)
2024-05-15 10:24:25 +00:00
.then(response => response.json())
2024-05-20 05:14:55 +00:00
.then(data => {
2024-05-21 08:12:02 +00:00
wyswietlSufiksy(data)
2024-05-20 09:38:56 +00:00
});
2024-05-21 08:05:17 +00:00
function wyswietlSufiksy(data) {
2024-05-20 09:38:56 +00:00
data.forEach((element) => document.querySelector('#nieposortowane').innerHTML += `<li> ${JSON.stringify(element.osoby)} </li>`);
2024-05-21 08:30:06 +00:00
}
document.getElementById("nieposortowane").onmouseover = function() {mouseOver()};
document.getElementById("nieposortowane").onmouseout = function() {mouseOut()};
function mouseOver() {
document.getElementById("nieposortowane").style.color = "red";
}
function mouseOut() {
document.getElementById("nieposortowane").style.color = "black";
}