-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
73 lines (61 loc) · 1.82 KB
/
admin.html
File metadata and controls
73 lines (61 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html>
<head>
<title>Admin Page</title>
<!-- <link rel="stylesheet" href="style.css" type="text/css"/> -->
</head>
<script src="/socket.io/socket.io.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
var Client = {};
Client.socket = io.connect();
function update(){
console.log("updated");
$.post("queue", function(data){
var list = "";
var name;
var q;
var id;
console.log(data);
data = JSON.parse(data);
console.log(data);
for (i = 0; i < data.length; i++){
name = data[i].name;
q = data[i].quest;
id = data[i]._id;
// console.log("id number: " + id);
list = list + '<form action="/remove" method="post">' + (i + 1)
+ "." + name + " asked " + q + "   " + '<button type="submit" name="ID" value = "'
+ id + '">Remove</button>' + '</form> <br> <br>';
}
$("#queue").html(list); //this replaces the Loading with the queue of students
});
};
/*
$(document).ready(function () {
$('form').on('submit', function(e) {
e.preventDefault();
console.log($(this));
console.log("this serialized is" + $(this).serialize());
$.post($(this).attr('action'), $(this).serialize(), function(data){
console.log("i guess we went through with this?")
update();
});
});
});
*/
update();
Client.socket.on("change", function(){
console.log("in change function");
update();
});
</script>
<html>
<h1> Welcome to the admin Page </h1>
<fieldset id="queue">
<p>Loading Queue...</p>
</html>
<!---
clicking remove posts remove to server
has to send info of WHO to remove
server than deletes that person -->