Compare commits
No commits in common. "d8a7ad538314d63a5e17e7d31dde586bf86fd83d" and "364c6f3ca9b4ba8788adc7021f3ea791646cfcf2" have entirely different histories.
d8a7ad5383
...
364c6f3ca9
5
get.php
5
get.php
|
@ -1,14 +1,13 @@
|
||||||
<?php
|
<?
|
||||||
$dbhost = "localhost";
|
$dbhost = "localhost";
|
||||||
$dbuser = "root";
|
$dbuser = "root";
|
||||||
$dbpass = "";
|
$dbpass = "";
|
||||||
$dbname = "osdb";
|
$dbname = "osoby";
|
||||||
|
|
||||||
$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");
|
||||||
$json = array();
|
$json = array();
|
||||||
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($ans)) {
|
while ($row = mysqli_fetch_assoc($ans)) {
|
||||||
$json[] = $row;
|
$json[] = $row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<pre id="nieposortowane"></pre>
|
<pre id="nieposortowane"></pre>
|
||||||
<h2>Posortowane Sufiksy</h2>
|
<h2>Posortowane Sufiksy</h2>
|
||||||
<pre id="posortowane"></pre>
|
<pre id="posortowane"></pre>
|
||||||
<script src="fetch.js"></script>
|
<script src="js.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
10
js.js
10
js.js
|
@ -1,11 +1,3 @@
|
||||||
const url = "http://localhost/pk/"
|
|
||||||
|
|
||||||
fetch( url + 'get.php')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then( data => {
|
|
||||||
console.log(data)
|
|
||||||
})
|
|
||||||
|
|
||||||
function sortujSufiksy() {
|
function sortujSufiksy() {
|
||||||
const slowo = document.getElementById('slowo').value;
|
const slowo = document.getElementById('slowo').value;
|
||||||
const sufiksy = [];
|
const sufiksy = [];
|
||||||
|
@ -15,7 +7,7 @@ function sortujSufiksy() {
|
||||||
document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
|
document.getElementById('nieposortowane').textContent = formatSufiksy(sufiksy);
|
||||||
sufiksy.sort();
|
sufiksy.sort();
|
||||||
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
document.getElementById('posortowane').textContent = formatSufiksy(sufiksy);
|
||||||
}git
|
}
|
||||||
function formatSufiksy(sufiksy) {
|
function formatSufiksy(sufiksy) {
|
||||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue