$.ajax({ type: "POST", url: "Rooms.aspx/GetAvailRoom", data: '{ Checkin: "' + $checkinDate + '", Checkout: "' + $checkoutDate + '" }', contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var rooms = response.d; alert(rooms); var html = ''; if ($.isEmptyObject(rooms)) { alert("Room is not Available!") var $showError = $('#showError').show().text('We are sorry, there are no rooms available for the dates you have requested.'); var $showContact = $('#showContact').show().html('If your dates are flexible, please speak to a hotel reservation agent at <strong>+250788400000</strong>.'); $('#divRooms').hide(); $('#notificationError').append($showError, '<br/>', $showContact) $('div.loading').hide(); } else if ((rooms == 'undefined') && (rooms == null)) { alert("Please go back and choose reservation!"); } else { $.each(rooms, function (index, item) { $RoomId = item.RoomId; html += '<div class="row" data-id=' + item.RoomId + '>'; html += '<div class="col-md-4">'; html += BxSlider(item); html += '</div>'; html += '<div class="col-md-4">'; html += '<h3 class="roomname success">' + item.RoomName + '</h3>'; html += '<p class="price"><em> ' + item.RoomPrice + '$</em> per night</p>'; html += '<span class="amentiesHeader">Full Description</span>'; html += '</div>'; html += '<div class="col-md-4">'; html += '<div class="roomextra">'; if (item.RoomDescription != null) { html += '<p class="notetitle">' + item.RoomDescription + '</p>'; } html += '<button type="button" class="btn btn-success btn-block book" data-id=' + $RoomId + '>BOOK NOW</button>'; html += '</div>'; html += '</div>'; html += '</div>'; }); } $('#divRooms').html(html); $('#divRooms div.row').each(function () { var RoomID = $(this).attr("data-id"); var pagerid = '#pager_' + RoomID; $(this).find('ul.bxslider').bxSlider({ pagerCustom: pagerid, controls: false }); }); $('div.loading').hide(); $('.book').on("click", function () { alert($RoomId); var url = "confirm-your-stay.aspx?checkin=" + encodeURIComponent($checkinDate) + "&checkout=" + encodeURIComponent($checkoutDate) + "&roomId=" + encodeURIComponent($RoomId) + "&adults=" + encodeURIComponent($adults) + "&children=" + encodeURIComponent($children); window.location.href = url; }); $("#loading").hide(); } });
;
$('#notificationError').append($showError, '<br/>', $showContact)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)