forked from umple/umple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestfortim.php
50 lines (40 loc) · 906 Bytes
/
testfortim.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
<?php
$message = "This was written in php but *outputted* in HTML";
if (isset($_REQUEST["callback"]))
{
$num = rand(0,100);
echo "A random number upto 100: {$num}";
exit;
}
?>
<html>
<head>
<title>Test for Tim</title>
<script src="scripts/ajax.js" type="text/javascript"></script>
<script>
function talkToServer()
{
Ajax.sendRequest("testfortim.php?",responseFromServer,"callback=1");
}
function responseFromServer(response)
{
var output = document.getElementById("output");
output.innerHTML = response.responseText;
}
</script>
</head>
<body>
<p>
STEP 1: Is PHP Working?
Message from PHP Land:
<div style="background-color:#f1f1f1">
<?php print $message ?>
</div>
</p>
STEP 2: Is AJAX Working?
<a href="javascript:talkToServer()">Click Here</a>
<div id="output" style="background-color:#f1f1f1">
This should be replaced by text when you click on the link above
</div>
</body>
</html>