diff --git a/fetch.js b/fetch.js index 6f62e7d..2517123 100644 --- a/fetch.js +++ b/fetch.js @@ -1,20 +1,26 @@ const url = "http://localhost/p20/get.php" +let lista fetch(url) .then(response => response.json()) .then(data => { - console.log(data) + // console.log(data) + sortujSufiksy(data) }) -function sortujSufiksy() { - const slowo = document.getElementById('slowo').value; - const sufiksy = []; - for (let i = 0; i < slowo.length; i++) { - sufiksy.push(slowo.slice(i)); - } - document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy); - sufiksy.sort(); - document.getElementById('posortowane').textContent = formatSufiksy(sufiksy); +function sortujSufiksy(data) { + + data.forEach((element) => { console.log(element) }); + + // const slowo = document.getElementById('slowo').value; + // console.log("tetst" + slowo) + // const sufiksy = []; + // for (let i = 0; i < slowo.length; i++) { + // sufiksy.push(slowo.slice(i)); + // } + // document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy); + // sufiksy.sort(); + // document.getElementById('posortowane').textContent = formatSufiksy(sufiksy); } function formatSufiksy(sufiksy) { diff --git a/get.php b/get.php index 1f484c2..3c36680 100644 --- a/get.php +++ b/get.php @@ -1,12 +1,8 @@ >>>>>> PiotrB -$dbuser = "root"; -$dbpass = ""; -$dbname = "db"; +$dbuser = "boost"; +$dbpass = "pass"; +$dbname = "osoby"; $conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $ans = mysqli_query($conn, "SELECT * FROM osoby"); diff --git a/index.html b/index.html index c010e6b..1efd15e 100644 --- a/index.html +++ b/index.html @@ -19,6 +19,10 @@

     
 
+    
  • +
      +
    1. + \ No newline at end of file