-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaderboard.php
77 lines (63 loc) · 1.7 KB
/
leaderboard.php
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
74
75
76
77
<?php
//attendance.php
include('header.php');
?>
<!--js for toggle related work-->
<script>
var checkbox = document.querySelector("input[id=togBtn]");
checkbox.addEventListener( 'change', function() {
document.body.classList.toggle("dark-theme");
document.getElementById("card").classList.toggle("dark-card");
});
</script>
<!--link css file for dark theme card-->
<link rel="stylesheet" href="css/card.css">
<div class="container" style="margin-top:30px">
<div class="card || dark-card" id="card">
<div class="card-header">
<div class="row">
<div class="col-md-9">Leaderboard</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<span id="message_operation"></span>
<table class="table table-striped table-bordered" id="user_table">
<thead>
<tr>
<th>Rank</th>
<th>User Name</th>
<th>High Score</th>
<th>Average Score</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
//check whether DOM is ready to run javascript code
$(document).ready(function(){
// call leaderboard_action.php to retrieve data
//$ means it is a jquery function
//datatable= jquery object containing data with the id usertable
var dataTable = $('#user_table').DataTable({
"processing":true,
"serverSide":true,
"order":[],
"ajax":{
url:"leaderboard_action.php",
method:"POST",
data:
{
action:"fetch"
},
}
});
});
</script>