var regExp = new RegExp(date_reg); if(!regExp.test(start_date)) { window.setTimeout(function() { $(".t-date-check-in label").trigger('click'); },100); return; } if(!regExp.test(end_date)) { window.setTimeout(function() { $(".t-date-check-out label").trigger('click'); },100); return; } $(".hotel-loading").show(); $.ajax({ type: 'POST', url: SITEURL + 'hotel/ajax_get_date_range_suit_status', data:{id:id,start_date:start_date,end_date:end_date}, dataType: 'json', complete:function(){ $(".hotel-loading").hide(); }, success: function (data) { if(data.status==1) { $("#room_list_con tr").each(function(){ $(this).removeClass('date-able'); $(this).find('.book_not').show(); $(this).find('.book_able').hide(); $(this).find('.reserve .left .text').hide(); }); for(var i in data.list) { var row=data.list[i]; var suitid = row['suitid']; $("#room_"+suitid+' .reserve .left .text').show(); $("#room_"+suitid+' .book_able').show(); $("#room_"+suitid+' .book_not').hide(); $("#room_"+suitid).addClass('date-able'); $("#room_"+suitid+' .reserve .num').html(CURRENCY_SYMBOL+''+row['price']+''); } if($('.date-able').length>0) { $("#room_list_con tr").each(function() { if(!$(this).hasClass('date-able')) { $(this).detach().insertAfter($(".date-able:last")); } }); } } } }); } });