Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function searchAvailability()
- {
- var resname=document.getElementById("resNameA").value;
- var reslocation=document.getElementById("resLocationA").value;
- var rescompany="Book A Meeting Room"
- var resfulltext=document.getElementById("resFulltextA").value;
- $.ajax({
- type: 'POST',
- url: 'booking/getavailability_search_XML.php',
- data: {
- name: encodeURIComponent(resname),
- location: encodeURIComponent(reslocation),
- company: "Book A Meeting Room",
- fulltext: encodeURIComponent(resfulltext),
- type: "a17joare" // Filter out bookings made from other applications application.
- // Most commonly user name of student
- },
- success: showAvailability,
- error: errormsg
- });
- }
- function showAvailability(returnedData)
- {
- // Fix characters in XML notation to HTML notation
- fixChars(returnedData);
- // An XML DOM document is returned from AJAX
- var resultset=returnedData.childNodes[0];
- var output="<table class='availResults' align='center'>";
- var elseoutput="<h2>Inga lediga tider</h2>";
- //var thead = "<th>bajs</th>";
- var dateSelectionFrom=new Date(document.getElementById("datepickerStart").value).valueOf();
- var dateSelectionTo= new Date(document.getElementById("datepickerEnd").value).valueOf();
- // Iterate over all nodes in root node (i.e. resources)
- for (i = 0; i < resultset.childNodes.length; i++) {
- // Iterate over all child nodes of that node that are resource nodes
- if(resultset.childNodes.item(i).nodeName=="availability"){
- // Retrieve data from resource nodes
- var avail=resultset.childNodes.item(i);
- var name = avail.attributes['name'].nodeValue;
- var dateFrom = new Date(avail.attributes['date'].nodeValue).valueOf();
- var dateTo = new Date(avail.attributes['dateto'].nodeValue).valueOf();
- // thead;
- if (dateFrom >=dateSelectionFrom && dateTo <= dateSelectionTo) {
- output+="<tr class='actiontablerow' onclick='alert(\""+avail.attributes['resourceID'].value+"\")'>";
- output+="<th>"+avail.attributes['name'].nodeValue+"</th>";
- output+="<td>"+avail.attributes['location'].nodeValue+"</td>";
- output+="<td>"+avail.attributes['size'].nodeValue+"</td>";
- output+="<td>"+avail.attributes['cost'].nodeValue+"</td>";
- output+="<td>"+avail.attributes['date'].nodeValue+"</td>";
- output+="<td>"+avail.attributes['dateto'].nodeValue+"</td>";
- output+="</tr>";
- }
- }
- }
- output+="</table>"
- var div=document.getElementById("OutputDivSearchA");
- div.innerHTML=output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement