1
<span class="description">
3
<div class="descriptionheading">Overview</div>
5
To make bookings, the main change is performed in the drawResult function, which adds a javascript call to the resources that have not been booked.
6
There is also a function that makes the booking and a function that redraws the display once a booking has been displayed using the processinputbox function from the previous examples.
10
<div class="descriptionheading">drawResult</div>
11
The function called <span class="interestingdescription">drawResult</span> is for the most part identical to the previous example. <br>
12
The only change is in the highlighted part of the function which draws the available resources. An onclick handler is given to those table items and
13
the javascript function called <span class="interestingdescription">bookPosition</span> is passed the number of the current item (from the booking position counter stored in the variable i).
17
<div class="descriptionheading">bookPosition</div>
18
The function called <span class="interestingdescription">bookPosition</span> is called each time the user clicks on a free slot in the list of bookings. The value of the parameter is
19
generated automatically by the drawResult function.
23
<div class="descriptionheading">makeResourceBooking</div>
24
<span class="interestingdescription">booking/makebooking_XML.php</span> makes a booking and returns the status for the booking that was made.
25
It returns the number of remaining resources for the given date and the exact cost that was computed and stored in the database (as the cost may change when more bookings are made and fewer bookings are available).
26
It is very important to note that no check is made that the resource is actually available at the given date.<br>It is thus very important to first use the resource available function to verify that the resource in fact is available for booking.<br>
27
<br>The class attribute that is returned is the cost class of the booking. If the category of the resource has the value 1 the pricing of the booking varies depending on the number of remaining
28
positions. If the class is low the pricing is low, if the class is high, the price increases (look at the example for <a href='AjaxDemoApp7_resourceAvailability.php'>resource availability</a> for in-depth coverage of pricing).
31
<div class='exampleheading'>Call Example:<br><br>
32
<pre><span class="codeexample">$.ajax({
34
url: 'booking/makebooking_XML.php',
41
status: "2", // 2 = "Real" booking.
53
<div class='exampleheading'>Returned Data Example:<br>
54
<pre><span class="codeexample">