-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasklist.html
78 lines (75 loc) · 2.72 KB
/
tasklist.html
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
78
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tasks Data Table</title>
<!-- Include DataTables CSS -->
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css">
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Include DataTables JS -->
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
</head>
<body>
<div class="container">
<h2>Tasks Data Table</h2>
<table id="tasksTable" class="display" style="width:100%">
<thead>
<tr>
<th>No.</th>
<th>Title</th>
<th>Updated (UTC)</th>
<th>Main Area / POI</th>
<th>DepartureInfo</th>
<th>ArrivalInfo</th>
<th>Distances (KM)</th>
</tr>
</thead>
<tbody>
<!-- Data will be inserted here by JavaScript -->
</tbody>
</table>
</div>
<script>
$(document).ready(function() {
// Fetch data from the PHP script
$.ajax({
url: 'GetTasks.php',
type: 'GET',
dataType: 'json',
success: function(tasks) {
console.log('Data fetched successfully:', tasks);
// Validate the response
if (!Array.isArray(tasks)) {
console.error('Data is not an array:', tasks);
return;
}
// Initialize the DataTable
$('#tasksTable').DataTable({
data: tasks,
columns: [
{ data: 'EntrySeqID' },
{ data: 'Title' },
{ data: 'LastUpdate' },
{ data: 'MainAreaPOI' },
{ data: 'DepartureInfo' },
{ data: 'ArrivalInfo' },
{ data: 'DistanceInfo' }
],
responsive: true,
paging: true,
searching: true,
ordering: true,
scrollX: true,
info: true
});
},
error: function(xhr, status, error) {
console.error('Error fetching data:', status, error);
}
});
});
</script>
</body>
</html>