4
table {border: 1px dotted gray; padding: 1em;}
7
<script language="javascript" src="../jquery/jquery-1.8.2.min.js"></script>
9
<script language="javascript">
10
// The API is passed a customer ID and the name of the return function
11
function ResultBookingCustomer(returnedData)
13
// An XML DOM document is returned from AJAX
14
var resultset=returnedData.childNodes[0];
18
// Iterate over all nodes in root node (i.e. bookings)
19
for (i = 0; i < resultset.childNodes.length; i++) {
20
// Iterate over all child nodes of that node that are booking nodes
21
if(resultset.childNodes.item(i).nodeName=="booking"){
22
// Retrieve first name and last name for node
23
var booking=resultset.childNodes.item(i);
26
output+="<td>"+booking.attributes['company'].nodeValue+"</td>";
27
output+="<td>"+booking.attributes['name'].nodeValue+"</td>";
28
output+="<td>"+booking.attributes['location'].nodeValue+"</td>";
29
output+="<td>"+booking.attributes['date'].nodeValue+"</td>";
36
var div=document.getElementById('OutputDiv');
40
function processinputbox()
42
customer =document.getElementById("customerID").value;
45
url: '../booking/getcustomerbookings_XML.php',
47
customerID: escape(customer)
48
// type: 'Hotell_Demo' // Optional: Can be specified to filter out bookings made from a certain application.
50
success: ResultBookingCustomer,
57
<form name='searchbookings'>
59
<input type='text' name='customerID' id='customerID' onchange="processinputbox()" onkeyup="processinputbox()">
62
<div id="OutputDiv" />