nit
This commit is contained in:
commit
42bd52f9a7
|
@ -0,0 +1,7 @@
|
|||
const url = "http://localhost/15.05/get.php"
|
||||
|
||||
fetch( url + 'get.php')
|
||||
.then(response => response.json())
|
||||
.then( data => {
|
||||
console.log(data)
|
||||
})
|
|
@ -0,0 +1,16 @@
|
|||
<?
|
||||
$dbhost = "localhost";
|
||||
$dbuser = "root";
|
||||
$dbpass = "";
|
||||
$dbname = "osoby";
|
||||
|
||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
$ans = mysqli_query($conn, "SELECT * FROM osoby");
|
||||
$json = array();
|
||||
|
||||
while ($row = mysqli_fetch_assoc($ans)) {
|
||||
$json[] = $row;
|
||||
}
|
||||
echo json_encode($json);
|
||||
|
||||
?>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<script src="fetch.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue