diff --git a/fetch.js b/fetch.js new file mode 100644 index 0000000..132e224 --- /dev/null +++ b/fetch.js @@ -0,0 +1,22 @@ +const url = "http://localhost/dev/get.php" +// const url = "http://qstack.pl:8080/z1/get.php" +let lista + +fetch(url) + .then(response => response.json()) + .then(data => { + wyswietlSufiksy(data) + }); + +function wyswietlSufiksy(data) { + data.forEach((element) => document.querySelector('#nieposortowane').innerHTML += `
  • ${JSON.stringify(element.osoby)}
  • `); +} + +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"; +} \ No newline at end of file