Compare commits
3 Commits
c225a7d197
...
24dc33d4cf
Author | SHA1 | Date |
---|---|---|
piotrb | 24dc33d4cf | |
piotrb | 2ac625d825 | |
piotrb | 433fcc4754 |
7
fetch.js
7
fetch.js
|
@ -1,8 +1,8 @@
|
|||
const url = "http://localhost/P20.05/get.php"
|
||||
const url = "http://localhost/p20/get.php"
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then( data => {
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
|
@ -15,7 +15,8 @@ function sortujSufiksy() {
|
|||
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');
|
||||
}
|
4
get.php
4
get.php
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
<<<<<<< HEAD
|
||||
$dbhost = "qstack.pl";
|
||||
=======
|
||||
$dbhost = "localhost";
|
||||
>>>>>>> PiotrB
|
||||
$dbuser = "root";
|
||||
$dbpass = "";
|
||||
$dbname = "db";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
@ -7,6 +8,7 @@
|
|||
<link rel="stylesheet" href="styles.css">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Sortowanie Sufiksów</h1>
|
||||
<input type="text" id="slowo" placeholder="Podaj słowo">
|
||||
|
|
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);
|
||||
}git
|
||||
function formatSufiksy(sufiksy) {
|
||||
return sufiksy.map((sufiks, index) => `${index + 1} ${sufiks}`).join('\n');
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f5f5f5;
|
||||
|
@ -14,7 +13,6 @@ h1 {
|
|||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
input[type="text"] {
|
||||
width: calc(100% - 22px);
|
||||
padding: 10px;
|
||||
|
@ -24,7 +22,6 @@ input[type="text"] {
|
|||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
|
@ -41,7 +38,6 @@ button:hover {
|
|||
background-color: #004494;
|
||||
}
|
||||
|
||||
|
||||
h2 {
|
||||
color: #0056b3;
|
||||
border-bottom: 2px solid #0056b3;
|
||||
|
|
Loading…
Reference in New Issue