fifth commit
This commit is contained in:
parent
a1fd1497a1
commit
b89ee1e8b5
4
fetch.js
4
fetch.js
|
@ -5,10 +5,8 @@ let lista
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
sortujSufiksy(data)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function sortujSufiksy(data) {
|
function wyswietlSufiksy(data) {
|
||||||
|
|
||||||
data.forEach((element) => document.querySelector('#nieposortowane').innerHTML += `<li> ${JSON.stringify(element.osoby)} </li>`);
|
data.forEach((element) => document.querySelector('#nieposortowane').innerHTML += `<li> ${JSON.stringify(element.osoby)} </li>`);
|
||||||
}
|
}
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Sortowanie Sufiksów</h1>
|
<h1>Sortowanie Sufiksów</h1>
|
||||||
<input type="text" id="slowo" placeholder="Podaj słowo">
|
|
||||||
<button onclick="sortujSufiksy()">Sortuj Sufiksy</button>
|
<button onclick="sortujSufiksy()">Sortuj Sufiksy</button>
|
||||||
<h2>Nieposortowane Sufiksy</h2>
|
<h2>Nieposortowane Sufiksy</h2>
|
||||||
<div class="pre" id="nieposortowane"></div>
|
<div class="pre" id="nieposortowane"></div>
|
||||||
|
@ -20,7 +19,7 @@
|
||||||
<script src="fetch.js"></script>
|
<script src="fetch.js"></script>
|
||||||
|
|
||||||
<li id="lista">
|
<li id="lista">
|
||||||
<ol></ol>
|
<ol></ol>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
17
qstack.php
17
qstack.php
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
$dbhost = "qstack.pl";
|
|
||||||
$dbuser = "root";
|
|
||||||
$dbpass = "";
|
|
||||||
$dbname = "osoby";
|
|
||||||
|
|
||||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
|
||||||
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
|
||||||
$json = array();
|
|
||||||
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($ans)) {
|
|
||||||
$json[] = $row;
|
|
||||||
}
|
|
||||||
echo json_encode($json);
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,6 +1,6 @@
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
background-color: #f5f5f5;
|
background-color: #f7f7f7f5;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
Loading…
Reference in New Issue