poprawione
This commit is contained in:
parent
c9adecf9b0
commit
e2c94ceeb1
5
get.php
5
get.php
|
@ -1,13 +1,14 @@
|
|||
<?
|
||||
<?php
|
||||
$dbhost = "localhost";
|
||||
$dbuser = "root";
|
||||
$dbpass = "";
|
||||
$dbname = "osoby";
|
||||
$dbname = "osdb";
|
||||
|
||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
||||
$json = array();
|
||||
|
||||
|
||||
while ($row = mysqli_fetch_assoc($ans)) {
|
||||
$json[] = $row;
|
||||
}
|
||||
|
|
28
js.js
28
js.js
|
@ -1,4 +1,4 @@
|
|||
const url = "http://localhost/15.05/get.php"
|
||||
const url = "http://localhost/pk/"
|
||||
|
||||
fetch( url + 'get.php')
|
||||
.then(response => response.json())
|
||||
|
@ -6,16 +6,16 @@ fetch( url + 'get.php')
|
|||
console.log(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 formatSufiksy(sufiksy) {
|
||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||
}
|
||||
// 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 formatSufiksy(sufiksy) {
|
||||
// return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue