当前位置: 民宿 > 民宿新闻

成都旅游酒店价格查询

2024-09-24 03:53分类: 民宿新闻 阅读:

 

本页面提供成都旅游酒店价格查询服务。请输入您的查询信息,我们将为您展示符合条件的酒店及价格。

{event.preventDefault();// 获取查询参数const formData = new FormData(form);const arrivalDate = formData.get('arrival-date');const departureDate = formData.get('departure-date');const numAdults = formData.get('num-adults');const numChildren = formData.get('num-children');// 显示加载状态resultsTable.style.display = 'none';resultsHeading.textContent = '正在加载查询结果...';// 执行查询fetch('/api/hotels', {method: 'POST',headers: {'Content-Type': 'application/json',},body: JSON.stringify({arrivalDate,departureDate,numAdults,numChildren,}),}).then((response) => response.json()).then((data) => {// 隐藏加载状态resultsHeading.textContent = '查询结果';// 清除现有结果resultsTable.tBodies[0].innerHTML = '';// 填充结果data.forEach((hotel) => {const row = document.createElement('tr');const nameCell = document.createElement('td');nameCell.textContent = hotel.name;row.appendChild(nameCell);const addressCell = document.createElement('td');addressCell.textContent = hotel.address;row.appendChild(addressCell);const starsCell = document.createElement('td');starsCell.textContent = hotel.stars;row.appendChild(starsCell);const priceCell = document.createElement('td');priceCell.textContent = `${hotel.price} 元`;row.appendChild(priceCell);resultsTable.tBodies[0].appendChild(row);});// 显示结果resultsTable.style.display = '';}).catch((error) => {// 显示错误信息resultsHeading.textContent = '查询失败。请重试。';console.error(error);});});


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

上一篇:四川景区住宿价格

下一篇:四川古尔沟华美达温泉酒店价格

附近酒店推荐

关注我们

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