4
table {border: 1px dotted gray; padding: 1em;}
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)
11
// An XML DOM document is returned from AJAX
12
var resultset=returnedData.childNodes[0];
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>";
30
var div=document.getElementById('OutputDiv');
34
function searchResources()
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;
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
56
<form name='searchbookings'>
58
<input type='text' value='' name='resName' id='resName' onchange="searchResources()" onkeyup="searchResources()"></br>
60
<input type='text' value='' name='resLocation' id='resLocation' onchange="searchResources()" onkeyup="searchResources()"></br>
62
<input type='text' value='' name='resCompany' id='resCompany' onchange="searchResources()" onkeyup="searchResources()"></br>
64
<input type='text' value='' name='resFulltext' id='resFulltext' onchange="searchResources()" onkeyup="searchResources()"></br>