/lenasys/0.1

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/0.1

« back to all changes in this revision

Viewing changes to trunk/Code Viewer Alt/AJAX/AjaxDemoApp10_getClicks.html

  • Committer: Henrik G.
  • Date: 2013-03-26 23:22:55 UTC
  • Revision ID: henrik.gustavsson@his.se-20130326232255-ik6snyatlbkf3zs1
First seed of Lenasys ... Needs to be Organized Further

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
                                <style>
 
4
                                                        td.result{border-bottom: 1px solid green;}
 
5
                                                        td.head{background-color:#ffeedd;border-top: 1px solid green;border-right: 1px solid green;border-bottom: 2px solid black;}
 
6
 
 
7
                                        table {border: 1px dotted gray; padding: 1em;}
 
8
                                </style>
 
9
 
 
10
                        <script language="javascript" src="../jquery/jquery-1.8.2.min.js"></script>
 
11
 
 
12
                                <script language="javascript">
 
13
 
 
14
                                                        // The API is passed a customer ID and the name of the return function
 
15
                                                        function ResultClicks(returnedData)
 
16
                                                        {
 
17
                                                                                // An XML DOM document is returned from AJAX
 
18
                                                                                var resultset=returnedData.childNodes[0];
 
19
 
 
20
                                                                                var output="<table>";
 
21
 
 
22
                                                                                // Iterate over all nodes in root node (i.e. customers)
 
23
                                      for (i = 0; i < resultset.childNodes.length; i++) {
 
24
                                                        // Iterate over all child nodes of that node that are booking nodes
 
25
                                                        if(resultset.childNodes.item(i).nodeName=="click"){
 
26
                                                                                                                        // Retrieve first name and last name for node
 
27
                                                                                                                        var booking=resultset.childNodes.item(i);
 
28
                                                                                                                        
 
29
                                                                                                                        output+="<tr>";
 
30
                                                                                                                        output+="<td>"+booking.attributes['numberofclicks'].nodeValue+"</td>";
 
31
                                                                                                                        output+="<td>"+booking.attributes['type'].nodeValue+"</td>";
 
32
                                                                                                                        output+="<td>"+booking.attributes['customerid'].nodeValue+"</td>";
 
33
                                                                                                                        output+="<td>"+booking.attributes['clickdata'].nodeValue+"</td>";
 
34
                                                                                                                        output+="</tr>";
 
35
                                                                                                                        
 
36
                                                        }
 
37
                                      }
 
38
 
 
39
                                                                                output+="</table>"
 
40
                                                                                var div=document.getElementById('OutputDiv');
 
41
                                                                                div.innerHTML=output;
 
42
                                                        }                               
 
43
 
 
44
                                                        function processinputbox()
 
45
                                                        {
 
46
                                                                        value=document.getElementById("resType").value;
 
47
                                                                $.ajax({
 
48
                                                                        type: 'POST',
 
49
                                                                        url: '../booking/getClicks_XML.php',
 
50
                                                                        data: {
 
51
                                                                                type: escape(value)
 
52
                                                                                // customerID: // Optional : The id of the customer
 
53
                                                                                                },
 
54
                                                                           success:  ResultClicks
 
55
                                                                    });                                                 
 
56
                                                        }
 
57
                                                        
 
58
                                </script>
 
59
</head>
 
60
<body>
 
61
        
 
62
        <form name='searchClicks'>
 
63
                                Application:<input type='text' name='resType' id='resType' onchange="processinputbox()" onkeyup="processinputbox()">
 
64
        </form>
 
65
        <br>
 
66
        <div id="OutputDiv" />
 
67
        <br>
 
68
        
 
69
</body>
 
70
</html>