Compare commits
29 Commits
Author | SHA1 | Date |
---|---|---|
amarcel | 603296b456 | |
amarcel | 9350d6acdc | |
amarcel | c561c3bb61 | |
amarcel | 7b806223be | |
amarcel | bf72a8d6c4 | |
amarcel | 85011e38f8 | |
amarcel | 4415c71a0f | |
amarcel | 9ed28d7f46 | |
u1 | 3cc3e92d8b | |
u1 | d7505f59d3 | |
Twoje Imię Nazwisko | edff1c9ebd | |
piotrb | 65c5b61829 | |
piotrb | bdda7e717f | |
piotrb | e527916149 | |
piotrb | 24dc33d4cf | |
piotrb | 2ac625d825 | |
james | c225a7d197 | |
james | e36e092d1d | |
james | d08593c413 | |
pawel | 817002a439 | |
pawel | d8a7ad5383 | |
james | d2145779c4 | |
pawel | 0cf2d32d88 | |
piotrb | 433fcc4754 | |
pawel | e2c94ceeb1 | |
pawel | c9adecf9b0 | |
pawel | 364c6f3ca9 | |
pawel | 7e73a7cea6 | |
pawel | 2455fa869f |
25
fetch.js
25
fetch.js
|
@ -1,7 +1,22 @@
|
||||||
const url = "http://localhost/15.05/get.php"
|
const url = "http://localhost/dev/get.php"
|
||||||
|
// const url = "http://qstack.pl:8080/z1/get.php"
|
||||||
|
let lista
|
||||||
|
|
||||||
fetch( url + 'get.php')
|
fetch(url)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then( data => {
|
.then(data => {
|
||||||
console.log(data)
|
wyswietlSufiksy(data)
|
||||||
})
|
});
|
||||||
|
|
||||||
|
function wyswietlSufiksy(data) {
|
||||||
|
data.forEach((element) => document.querySelector('#nieposortowane').innerHTML += `<li> ${JSON.stringify(element.osoby)} </li>`);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById("nieposortowane").onmouseover = function() {mouseOver()};
|
||||||
|
document.getElementById("nieposortowane").onmouseout = function() {mouseOut()};
|
||||||
|
function mouseOver() {
|
||||||
|
document.getElementById("nieposortowane").style.color = "red";
|
||||||
|
}
|
||||||
|
function mouseOut() {
|
||||||
|
document.getElementById("nieposortowane").style.color = "black";
|
||||||
|
}
|
13
get.php
13
get.php
|
@ -1,16 +1,17 @@
|
||||||
<?
|
<?php
|
||||||
$dbhost = "localhost";
|
$dbhost = "qstack.pl";
|
||||||
$dbuser = "root";
|
$dbuser = "boost";
|
||||||
$dbpass = "";
|
$dbpass = "pass";
|
||||||
$dbname = "osoby";
|
$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");
|
||||||
$json = array();
|
$json = array();
|
||||||
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($ans)) {
|
while ($row = mysqli_fetch_assoc($ans)) {
|
||||||
$json[] = $row;
|
$json[] = $row;
|
||||||
}
|
}
|
||||||
echo json_encode($json);
|
echo json_encode($json);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
20
index.html
20
index.html
|
@ -1,13 +1,25 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="pl">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Document</title>
|
<title>Sortowanie Sufiksów</title>
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<h2>Nieposortowane Sufiksy</h2>
|
||||||
|
<div class="pre" id="nieposortowane"></div>
|
||||||
|
<h2>Posortowane Sufiksy</h2>
|
||||||
|
<div class="pre" id="posortowane"></div>
|
||||||
<script src="fetch.js"></script>
|
<script src="fetch.js"></script>
|
||||||
|
|
||||||
|
<li id="lista">
|
||||||
|
<ol></ol>
|
||||||
|
</li>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -0,0 +1,60 @@
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: #333;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
color: #0056b3;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="text"] {
|
||||||
|
width: calc(100% - 22px);
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #0056b3;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #004494;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
color: #0056b3;
|
||||||
|
border-bottom: 2px solid #0056b3;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nieposortowane {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* .pre {
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow-x: auto;
|
||||||
|
} */
|
Loading…
Reference in New Issue