/lenasys/trunk

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

« back to all changes in this revision

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

  • Committer: elof.bigestans at gmail
  • Date: 2013-05-24 10:00:47 UTC
  • mto: This revision was merged to the branch mainline in revision 95.
  • Revision ID: elof.bigestans@gmail.com-20130524100047-bqgk67s2g9o3l85x
Solved some bugs in ManageCourses and related files (CSS, JS, View, Controller)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<html>
2
 
<head>
3
 
                                <style>
4
 
                                        table {border: 1px dotted gray; padding: 1em;}
5
 
                                </style>
6
 
 
7
 
                        <script language="javascript" src="../jquery/jquery-1.8.2.min.js"></script>
8
 
 
9
 
                                <script language="javascript">
10
 
 
11
 
                                                        // The API is passed a resource ID and a dataset containing the availability is returned
12
 
                                                        function ResultAvailability(returnedData)
13
 
                                                        {
14
 
                                                                        // An XML DOM document is returned from AJAX
15
 
                                                                        var resultset=returnedData.childNodes[0];
16
 
 
17
 
                                                                        var output="<table>";
18
 
                                                                        // Iterate over all nodes in root node (i.e. availability elements)
19
 
                                                                        for (i = 0; i < resultset.childNodes.length; i++) {
20
 
                                                                                        if(resultset.childNodes.item(i).nodeName=="availability"){
21
 
                                                                                                        // Retrieve attributes and show in table
22
 
                                                                                                        var availability=resultset.childNodes.item(i);
23
 
                                                                                                        output+="<tr><td>"+availability.attributes['date'].nodeValue+"</td>";
24
 
                                                                                                        output+="<td>"+availability.attributes['bookingcount'].nodeValue+"</td>";                                                                                                       
25
 
                                                                                                        output+="<td>"+availability.attributes['bookingcost'].nodeValue+"</td>";                                                                                                        
26
 
                                                                                                        output+="<td>"+availability.attributes['bookingclass'].nodeValue+"</td>";                                                                                                       
27
 
                                                                                                        output+="<td>"+availability.attributes['remaining'].nodeValue+"</td>";                                                                                                  
28
 
                                                                                        }
29
 
                                                                        }
30
 
                                                                        output+="</table>"
31
 
                                                                        var div=document.getElementById('OutputDiv');
32
 
                                                                        div.innerHTML=output;
33
 
                                                        }                               
34
 
                                                        
35
 
                                                        function processinputbox()
36
 
                                                        {
37
 
                                                                        resource=document.getElementById("resourceID").value;
38
 
 
39
 
                                                $.ajax({
40
 
                                                                type: 'POST',
41
 
                                                                url: '../booking/getavailability_XML.php',
42
 
                                                                data: {
43
 
                                                                //      type: escape("Hotell_Demo"), // optional.
44
 
                                                                        resourceID: resource
45
 
                                                                },
46
 
                                                                success:  ResultAvailability
47
 
                                                        });
48
 
                
49
 
                                                                //      getResourceAvailability(resource,"Hotell_Demo","ResultAvailability")
50
 
                                                        }
51
 
                                                        
52
 
                                </script>
53
 
</head>
54
 
<body>
55
 
        
56
 
        <form name='searchbookings'>
57
 
                                Resource:<input type='text' name='resourceID' id='resourceID' onchange="processinputbox()" onkeyup="processinputbox()"><br>
58
 
        </form>
59
 
        <br>
60
 
        <div id="OutputDiv">
61
 
                <br>
62
 
        
63
 
</body>
64
 
</html>