-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
84 lines (75 loc) · 2.32 KB
/
index.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
79
<!DOCTYPE html>
<html>
<head>
<title>Easy Morning</title>
<link rel='stylesheet' type='text/css' href='css/style.css'/>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
<table class="table table-striped" id="table_div">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
</tr>
</thead>
<tbody>
</tbody>
<tr>
<td></td>
<td>
<label>Date: <input type="text" id="prev" placeholder="previous days"></label>
</td>
<td>
<button id="download" class="btn btn-primary" type="button">Download EasyFM</button>
</td>
</tr>
</table>
<div class='result'></div>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
/*
var data = { "programs" : [{
"ID" : 1,
"Name" : 'ezm130816.mp3',
"Date" : 20130816
},
{
"ID" : 2,
"Name" : 'ezm130816.mp3',
"Date" : 20130816
}]
};
$.each(data.programs, function () {
$('#table_div > tbody:first').before('<tr><td>' + this.ID + '</td><td><a href=\"' + this.Name + "\">" + this.Name + '</a></td><td>' + this.Date + '</td></tr>');
});
*/
$('#download').on('click', function (e) {
console.log('download');
var prev_days = document.getElementById("prev").value;
$.get('./download.php?prev=' + prev_days, function (data) {
$('.result').html(data);
console.log('Load was performed.');
});
});
$.getJSON('./getdata.php').done(function (data) {
//console.log(data);
$.each(data.programs, function () {
$('#table_div > tbody:first').before('<tr><td>'
+ this.ID
+ '</td><td><a href=\"' + this.Name + "\">"
+ this.Name + '</a></td><td>' + this.Date
+ '</td></tr>');
});
}).fail(function (jqxhr, textStatus, error) {
var err = textStatus + ', ' + error;
//console.log( "Request Failed: " + err);
});
});
</script>
</body>
</html>