/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 Code Viewer Alt/AJAX/AjaxDemoApp3_getResources_description.html

  • Committer: b11johgu
  • Date: 2013-05-16 12:50:39 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: b11johgu@student.his.se-20130516125039-2vlxix2829z1hchh
deleted files not used
Added data in table "Users"

Show diffs side-by-side

added added

removed removed

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