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"
|
||||
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) {
|
||||
|
|
10
get.php
10
get.php
|
@ -1,12 +1,8 @@
|
|||
<?php
|
||||
<<<<<<< HEAD
|
||||
$dbhost = "qstack.pl";
|
||||
=======
|
||||
$dbhost = "localhost";
|
||||
>>>>>>> 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");
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
<pre id="posortowane"></pre>
|
||||
<script src="fetch.js"></script>
|
||||
|
||||
<li id="lista">
|
||||
<ol></ol>
|
||||
</li>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue