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
|
<html>
<head>
<style>
td.result{border-bottom: 1px solid green;}
td.head{background-color:#ffeedd;border-top: 1px solid green;border-right: 1px solid green;border-bottom: 2px solid black;}
table {border: 1px dotted gray; padding: 1em;}
</style>
<script language="javascript" src="../jquery/jquery-1.8.2.min.js"></script>
<script language="javascript">
// The API is passed a customer ID and the name of the return function
function ResultClicks(returnedData)
{
// An XML DOM document is returned from AJAX
var resultset=returnedData.childNodes[0];
var output="<table>";
// Iterate over all nodes in root node (i.e. customers)
for (i = 0; i < resultset.childNodes.length; i++) {
// Iterate over all child nodes of that node that are booking nodes
if(resultset.childNodes.item(i).nodeName=="click"){
// Retrieve first name and last name for node
var booking=resultset.childNodes.item(i);
output+="<tr>";
output+="<td>"+booking.attributes['numberofclicks'].nodeValue+"</td>";
output+="<td>"+booking.attributes['type'].nodeValue+"</td>";
output+="<td>"+booking.attributes['customerid'].nodeValue+"</td>";
output+="<td>"+booking.attributes['clickdata'].nodeValue+"</td>";
output+="</tr>";
}
}
output+="</table>"
var div=document.getElementById('OutputDiv');
div.innerHTML=output;
}
function processinputbox()
{
value=document.getElementById("resType").value;
$.ajax({
type: 'POST',
url: '../booking/getClicks_XML.php',
data: {
type: escape(value)
// customerID: // Optional : The id of the customer
},
success: ResultClicks
});
}
</script>
</head>
<body>
<form name='searchClicks'>
Application:<input type='text' name='resType' id='resType' onchange="processinputbox()" onkeyup="processinputbox()">
</form>
<br>
<div id="OutputDiv" />
<br>
</body>
</html>
|