1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<span class="description">
<br>
<div class="descriptionheading">Overview</div>
The resource search is a variation on a classical search form. A number of optional search terms are entered and a result is retrieved based on those parameters.
<div class="descriptionheading">searchResources</div>
The function called <span class="interestingdescription">searchResources</span> is executed by the keyup and onchange events for the text boxes in the form.
Events connected to text boxes are suitable for this type of application since attaching code to those events allows the capture of text written
into a dialog box while the user keeps typing.<br>
The search terms are collected from the form and passed directly to the api. The
<br><br>
<div class="descriptionheading">showResources</div>
The other function <span class="interestingdescription">showResources</span> is nearly identical to the result function of the previous example <a href='AjaxDemoApp2_getCustomerBookings.php'>getCustomerBookings</a>.
<br><br><div class="descriptionheading">getResources</div>
The <span class="interestingdescription">booking/getresources_XML.php</span> performs a search using a set of search terms.
"None" is given, that search term is ignored. <br> The three first terms i.e. name, location and company use a logical or if more than one term is given.
The full text search works in isolation from the other terms.
<br><br><div class='exampleheading'>Call Example:<br><br>
<pre class="codeexample">
$.ajax({
type: 'POST',
url: 'booking/getresources_XML.php',
data: { name: escape(document.getElementById("resName").value),
location: escape(document.getElementById("resLocation").value),
company: escape(document.getElementById("resCompany").value),
fulltext: escape(document.getElementById("resFulltext").value) },
success: showResources
});
</pre>
</div>
<br>
<br><div class='exampleheading'>Returned Data Example:<br>
<pre><span class="codeexample">
<resources>
<resource
id='1001'
name='Pilkington Inn'
company='Sunside Hotels'
location='Manchester'
size='15'
cost='350'
/>
</resource>
</span>
</div>
</span></pre>
|