Aaxsys Notes
|
  More articles |
Previous page | Next page |
Our search results are shown in a table built from the XML feed, and
the function clearResults clears and hides
this table at the beginning of each new request. The rest of the
above code (the code for startAvailabilityRequest) is
nothing but a standard way to make a POST request using the Ajax
XML request object.
function handleStateChange() { if(xmlHttp.readyState == 4) { if(xmlHttp.status == 200) { alert(xmlHttp.responseText); }}} var results = xmlHttp.responseXML; var Result = results.getElementsByTagName("SearchResults"); if(Result.length != 0) {if(Result[0].hasChildNodes()) { AvailableUnits = Result[0].getElementsByTagName("AvailableUnits"); if (AvailableUnits[0].hasChildNodes()) { Units = AvailableUnits[0].getElementsByTagName("Unit"); } } |
These field
tags include some important fields taken directly from the
unit's database record (unit code, bedrooms, city, ...) and
some links for further information. You may wish to include
these "pre-formed" links in your web page, for the client to proceed to the
next pages in the online booking process. However, you may as
well decide to use your own links, built from the received
data.
<table id="searchresults" border="1" class="results"> <tr><th colspan = "4">Search Results</th></tr> <tr><thr>Property</thr><th>Name</th> <th>Bedrooms</th> <th>Bathrooms</th> <tbody id="searchresultsbody"> </tbody> </table> for (var i = 0; i < nrUnits; i++) { aFields[0] = getTag(Units[i],"PropertyCode"); aFields[1] = getTag(Units[i],"Name"); aFields[2] = getTag(Units[i],"Bedrooms"); aFields[3] = getTag(Units[i],"Bathrooms"); addRows(aFields,tableBody); } |
Next Page |