third commit
This commit is contained in:
parent
e36e092d1d
commit
3594287422
2
fetch.js
2
fetch.js
|
@ -1,4 +1,4 @@
|
|||
const url = "http://localhost/P20.05/get.php"
|
||||
const url = "http://localhost/p20/get.php"
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
|
|
8
get.php
8
get.php
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
$dbhost = "localhost";
|
||||
$dbuser = "root";
|
||||
$dbpass = "";
|
||||
$dbname = "osdb";
|
||||
$dbhost = "qstack.pl";
|
||||
$dbuser = "boost";
|
||||
$dbpass = "pass";
|
||||
$dbname = "osoby";
|
||||
|
||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
||||
|
|
21
js.js
21
js.js
|
@ -1,21 +0,0 @@
|
|||
const url = "http://localhost/P20.05"
|
||||
|
||||
fetch('get.php')
|
||||
.then(response => response.json())
|
||||
.then( data => {
|
||||
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');
|
||||
}
|
Loading…
Reference in New Issue