dodanie planu

This commit is contained in:
User Kill3rs4 2022-01-25 16:00:37 +01:00
parent 8efa6c3f82
commit 10662d2b44
7 changed files with 104 additions and 34 deletions

36
backend/plan.php Normal file
View File

@ -0,0 +1,36 @@
<table>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Job title</th>
</tr>
<tbody id="data"></tbody>
</table>
<script>
var ajax = new XMLHttpRequest();
ajax.open("GET", "data.php", true);
ajax.send();
ajax.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var data = JSON.parse(this.responseText);
console.log(data);
var html = "";
for(var a = 0; a < data.length; a++) {
var firstName = data[a].firstName;
var lastName = data[a].lastName;
var jobTitle = data[a].jobTitle;
html += "<tr>";
html += "<td>" + firstName + "</td>";
html += "<td>" + lastName + "</td>";
html += "<td>" + jobTitle + "</td>";
html += "</tr>";
}
document.getElementById("data").innerHTML += html;
}
};
</script>

1
node_modules/.bin/mime generated vendored
View File

@ -1 +0,0 @@
../mime/cli.js

8
node_modules/.bin/mime generated vendored Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env node
var mime = require('./mime.js');
var file = process.argv[2];
var type = mime.lookup(file);
process.stdout.write(type + '\n');

View File

@ -1,6 +1,6 @@
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<title>BezVulcan</title>
<meta charset="utf-8">
<link rel="stylesheet" href="menu.css">
@ -8,7 +8,6 @@
<body>
<script src="showMenu.js"></script>
<script src="witaj.js"></script>
<script src="logout.js"></script>
<div id="menu" class="menu">
<button type="button" id="show-menu" class="show-menu" onclick="showMenu();">

View File

@ -1,15 +1,31 @@
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<title>BezVulcan</title>
<meta charset="utf-8">
<link rel="stylesheet" href="menu.css">
</head>
<body>
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("txtHint").innerHTML = this.responseText;
}
};
xmlhttp.open("GET","https://backend.kill3rs4.usermd.net/plan.php?q="+str,true);
xmlhttp.send();
}
}
</script>
<script src="plan.js"></script>
<script src="showMenu.js"></script>
<script src="witaj.js"></script>
<script src="plan.js></script>
<script src="logout.js"></script>
<div id="menu" class="menu">
<button type="button" id="show-menu" class="show-menu" onclick="showMenu();">
@ -22,7 +38,7 @@
<h3>Menu</h3>
<ul>
<li><a href="komunikat">Komunikaty</a></li>
<li><a href="plan">Plan lekcji</a></li>
<li><a href="home">Strona Główna</a></li>
<li><a href="oceny">Oceny</a></li>
<li><a href="wychowawca">Wychowawca</a></li>
<li><a href="uwagi">Uwagi ucznia</a></li>
@ -30,6 +46,17 @@
</ul>
</div>
</div>
<center>
<select name="users" onchange="showUser(this.value)">
<option value="">Wybierz klase:</option>
<option value="1">1a</option>
<option value="2">1b</option>
<option value="3">1c</option>
<option value="4">2a</option>
</select>
</form>
<br>
<div id="txtHint"><b>Lista</b></div>
</center>
</body>
</html>

View File

@ -1,26 +1,7 @@
var mysql = require('mysql');
var config = require('./config.js');
var db_access = {
host : config.db.host,
user : config.db.username,
password : config.db.password,
database : config.db.dbname
};
var tbl = plan;
var conn = mysql.createConnection(db_access);
conn.connect();
var queryString = 'SELECT * FROM ' + tbl;
conn.query(queryString, function (err, rows, fields) {
if (err) { throw err; }
for (var i in rows) {
console.log('TESTDUPA: ', rows[i].name);
}
$(document).ready(function(){
$("guzik").click(function(){
$.get("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
conn.end();

20
public/test.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.get("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</script>
</head>
<body>
<button>Send an HTTP GET request to a page and get the result back</button>
</body>
</html>

View File

@ -1,3 +1,3 @@
app.get('/home', function(request, response) {
response.send('Witaj, ' + request.session.username + '!');
}
)}