dane przekazane do funkcji
This commit is contained in:
parent
24dc33d4cf
commit
e527916149
26
fetch.js
26
fetch.js
|
@ -1,20 +1,26 @@
|
||||||
const url = "http://localhost/p20/get.php"
|
const url = "http://localhost/p20/get.php"
|
||||||
|
let lista
|
||||||
|
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(data)
|
// console.log(data)
|
||||||
|
sortujSufiksy(data)
|
||||||
})
|
})
|
||||||
|
|
||||||
function sortujSufiksy() {
|
function sortujSufiksy(data) {
|
||||||
const slowo = document.getElementById('slowo').value;
|
|
||||||
const sufiksy = [];
|
data.forEach((element) => { console.log(element) });
|
||||||
for (let i = 0; i < slowo.length; i++) {
|
|
||||||
sufiksy.push(slowo.slice(i));
|
// const slowo = document.getElementById('slowo').value;
|
||||||
}
|
// console.log("tetst" + slowo)
|
||||||
document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
|
// const sufiksy = [];
|
||||||
sufiksy.sort();
|
// for (let i = 0; i < slowo.length; i++) {
|
||||||
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
// sufiksy.push(slowo.slice(i));
|
||||||
|
// }
|
||||||
|
// document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
|
||||||
|
// sufiksy.sort();
|
||||||
|
// document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSufiksy(sufiksy) {
|
function formatSufiksy(sufiksy) {
|
||||||
|
|
10
get.php
10
get.php
|
@ -1,12 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
<<<<<<< HEAD
|
|
||||||
$dbhost = "qstack.pl";
|
$dbhost = "qstack.pl";
|
||||||
=======
|
$dbuser = "boost";
|
||||||
$dbhost = "localhost";
|
$dbpass = "pass";
|
||||||
>>>>>>> PiotrB
|
$dbname = "osoby";
|
||||||
$dbuser = "root";
|
|
||||||
$dbpass = "";
|
|
||||||
$dbname = "db";
|
|
||||||
|
|
||||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||||
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
<pre id="posortowane"></pre>
|
<pre id="posortowane"></pre>
|
||||||
<script src="fetch.js"></script>
|
<script src="fetch.js"></script>
|
||||||
|
|
||||||
|
<li id="lista">
|
||||||
|
<ol></ol>
|
||||||
|
</li>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue