当前位置: 民宿 > 成都旅游

附近大酒店住宿查询 (附近大酒店住宿)

2024-10-18 15:43分类: 成都旅游 阅读:

 

填写以下信息以查找附近的酒店住宿

<select id="num-guests" required="">
<script> const form = document.getElementById('form');const results = document.getElementById('results');form.addEventListener('submit', async (e) => {e.preventDefault();const location = document.getElementById('location').value;const checkIn = document.getElementById('check-in').value;const checkOut = document.getElementById('check-out').value;const numGuests = document.getElementById('num-guests').value;const query = `location=${location}&check_in=${checkIn}&check_out=${checkOut}&num_guests=${numGuests}`;const response = await fetch(`${query}`);const data = await response.json();results.innerHTML = '';if (data.length > 0) {data.forEach((hotel) => {const resultItem = document.createElement('div');resultItem.classList.add('result-item');const hotelName = document.createElement('p');hotelName.textContent = hotel.name;const hotelAddress = document.createElement('p');hotelAddress.textContent = hotel.address;const hotelPrice = document.createElement('p');hotelPrice.textContent = `价格:${hotel.price} 元`;resultItem.appendChild(hotelName);resultItem.appendChild(hotelAddress);resultItem.appendChild(hotelPrice);results.appendChild(resultItem);});} else {const noResults = document.createElement('p');noResults.textContent = '没有找到符合条件的酒店。';results.appendChild(noResults);}});


郑重声明:本文由:成都旅游于(2024-10-18)发表了关于附近大酒店住宿查询 (附近大酒店住宿)的文章。如转载请注明出处!部分文章来源于网络,仅作为参考,如果网站中图片和文字侵犯了您的版权,请联系我们处理!

上一篇:就近宾馆查询附近酒店 (最近酒店住宿查询)

下一篇:查询附近的酒店 (查询附近的酒店要下载什么软件)

附近酒店推荐

关注我们

    民宿酒店不一样的选择,更好的体验