First try AJAX

This commit is contained in:
d3m1g0d
2019-04-06 15:18:43 +02:00
parent 2e4c7e2683
commit fc112d997b
3 changed files with 147 additions and 137 deletions

View File

@@ -1,4 +1,7 @@
function kebab () {
$('#values').html('kebab');
console.log('yeet');
$('#update').click(updateData())
function updateData () {
const url = 'http:' + window.location.hostname + ':5000/data'
$.get(url, function (data, status) {
$('#debug').text(data)
})
}

View File

@@ -1,16 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<link rel="stylesheet" href="lib/bootstrap.min.css">
<link rel="stylesheet" href="stylesheet.css">
<title>TeraHz</title>
</head>
<body>
<div class="container text-center"><h1>TeraHz</h1></div>
<div class="container text-center">
<h1>TeraHz</h1>
</div>
<div class="container">
<h3>Vrednosti:</h3><br>
<button class="btn btn-primary m-1 float-right">Get data</button>
<button id="update" class="btn btn-primary m-1 float-right">Get data</button>
<p id="debug">
</p>
<table class="table table-sm">
<thead class="thead-dark">
<tr>
@@ -116,4 +122,5 @@
<script src="lib/jquery-3.3.1.min.js"></script>
<script src="frontend.js"></script>
</body>
</html>