/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/AjaxDemoApp3_getResources.html

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-17 11:35:28 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130517113528-j91o0iq4t7mzeas7
Fixed the loginview

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
 
        <script language="javascript" src="../jquery/jquery-1.8.2.min.js"></script>
7
 
                <script language="javascript">
8
 
                        // The API is passed a resource name, company or location and/or a fulltext
9
 
                        function showResources(returnedData)
10
 
                        {
11
 
                                        // An XML DOM document is returned from AJAX
12
 
                                        var resultset=returnedData.childNodes[0];
13
 
                                        var output="<table>";
14
 
                                        // Iterate over all nodes in root node (i.e. resources)
15
 
                                        for (i = 0; i < resultset.childNodes.length; i++) {
16
 
                                                        // Iterate over all child nodes of that node that are resource nodes
17
 
                                                        if(resultset.childNodes.item(i).nodeName=="resource"){
18
 
                                                                        // Retrieve data from resource nodes
19
 
                                                                        var resource=resultset.childNodes.item(i);
20
 
                                                                        output+="<tr onclick='alert(\""+resource.attributes['id'].value+"\")'>";
21
 
                                                                        output+="<td>"+resource.attributes['company'].nodeValue+"</td>";
22
 
                                                                        output+="<td>"+resource.attributes['name'].nodeValue+"</td>";
23
 
                                                                        output+="<td>"+resource.attributes['location'].nodeValue+"</td>";
24
 
                                                                        output+="</tr>";
25
 
                                                                                        
26
 
                                                        }
27
 
                                        }
28
 
 
29
 
                                        output+="</table>"
30
 
                                        var div=document.getElementById('OutputDiv');
31
 
                                        div.innerHTML=output;
32
 
                        }                               
33
 
                        
34
 
                        function searchResources()
35
 
                        {
36
 
                                        var resname=document.getElementById("resName").value;
37
 
                                        var reslocation=document.getElementById("resLocation").value;
38
 
                                        var rescompany=document.getElementById("resCompany").value;
39
 
                                        var resfulltext=document.getElementById("resFulltext").value;
40
 
 
41
 
                                                        $.ajax({
42
 
                                                                type: 'POST',
43
 
                                                                url: '../booking/getresources_XML.php',
44
 
                                                                data: { name: escape(document.getElementById("resName").value),
45
 
                                                                        location:  escape(document.getElementById("resLocation").value),
46
 
                                                                        company: escape(document.getElementById("resCompany").value),
47
 
                                                                        fulltext: escape(document.getElementById("resFulltext").value) },
48
 
                                                                success:  showResources
49
 
                                                        });
50
 
                        }
51
 
                        
52
 
                </script>
53
 
</head>
54
 
<body>
55
 
        
56
 
        <form name='searchbookings'>
57
 
                                Name:</br>
58
 
                                 <input type='text' value='' name='resName' id='resName' onchange="searchResources()" onkeyup="searchResources()"></br>
59
 
                                Location:</br>
60
 
                                 <input type='text' value='' name='resLocation' id='resLocation' onchange="searchResources()" onkeyup="searchResources()"></br>
61
 
                                Company:</br>
62
 
                                 <input type='text' value='' name='resCompany' id='resCompany' onchange="searchResources()" onkeyup="searchResources()"></br>
63
 
                                Freetext:</br>
64
 
                                 <input type='text' value='' name='resFulltext' id='resFulltext' onchange="searchResources()" onkeyup="searchResources()"></br>
65
 
        </form>
66
 
        <br>
67
 
        <div id="OutputDiv">
68
 
                <br>
69
 
        
70
 
</body>
71
 
</html>