-
Notifications
You must be signed in to change notification settings - Fork 0
/
exe.html
47 lines (44 loc) · 987 Bytes
/
exe.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
<html><head>
<title> AJAX Demo </title>
<style>
body{
text-align: center;
}
.displaybox{
margin: auto;
text-decoration-color: "#FF0000";
color: "#FF0000";
width: 150px;
padding: 10px;
align: center;
font: 1.5em normal verdana, helvetica, arial;
}
</style>
<script>
var ajaxobject=new XMLHttpRequest();
function getServerTime() {
if(!ajaxobject)
{
document.getElementById("showtime").innerHTML="AJAX obejct could not be created";
return;
}
ajaxobject.open("GET","bday.php");
ajaxobject.send();
ajaxobject.onreadystatechange=getResponse;
}
function getResponse(){
if(ajaxobject.readyState == 4 && ajaxobject.status == 200)
{
document.getElementById('showtime').innerHTML=ajaxobject.responseText;
}
}
</script>
</head>
<body >
<h1>Today's your special day! </h1>
<form>
<input value="Why's that?" onclick="getServerTime()" type="button">
</form>
<div id="showtime" class="displaybox">
</div>
</body></html>