-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax.html
59 lines (51 loc) · 1.62 KB
/
ajax.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ajax Demo</title>
<meta charset="UTF-8">
<meta name="description" content="Ajax Demo">
<meta name="author" content="Johnson">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div class="container">
<button class="btn tb-btn" type="button">TimeTable</button>
<button class="btn cv-btn" type="button">CV</button>
<div>
<div id="tb">
</div>
<div id="cv">
</div>
</div>
<script>
$(".cv-btn").click(function(){
$("#cv").html("");
setTimeout(function(){load(1);},2000);
});
$(".tb-btn").click(function(){
$("#tb").html("");
setTimeout(function(){load(0);},2000);
});
function load(x){
if(x==1)
$("#cv").load("cv.txt", function(response,status,xhr){
if(status == "error")
alert("Error loading file!");
});
else
$("#tb").load("timetable.txt",function(response,status,xhr){
if(status == "error")
alert("Error loading file!");
});
}
$(function(){
load(1);
load(0);
});
</script>
</body>
</html>