成都民宿

成都民宿

当前位置: 主页 > 成都民宿

附近宾馆查询100米内最近的便宜酒店 (附近宾馆查询500米内50至60元)

作者:企业邮箱       发布于:2024-11-06        点击量: 352

请输入您的位置信息和搜索条件,我们将为您找到附近的便宜酒店。

<script> const form = document.querySelector('form');const results = document.querySelector('.results');const hotelList = document.getElementById('hotel-list');form.addEventListener('submit', (e) => {e.preventDefault();const latitude = document.getElementById('latitude').value;const longitude = document.getElementById('longitude').value;const radius = document.getElementById('radius').value;const minPrice = document.getElementById('min-price').value;const maxPrice = document.getElementById('max-price').value;if (!latitude || !longitude) {alert('请输入纬度和经度!');return;}// 调用 API 查询附近的酒店fetch(`${latitude}&longitude=${longitude}&radius=${radius}&minPrice=${minPrice}&maxPrice=${maxPrice}`).then((response) => response.json()).then((data) => {results.style.display = 'block';// 清除之前的查询结果hotelList.innerHTML = '';// 遍历查询结果并显示酒店信息data.forEach((hotel) => {const hotelItem = document.createElement('div');hotelItem.classList.add('hotel-item');const hotelName = document.createElement('span');hotelName.classList.add('hotel-name');hotelName.textContent = hotel.name;const hotelPrice = document.createElement('span');hotelPrice.classList.add('hotel-price');hotelPrice.textContent = `¥${hotel.price}`;hotelItem.appendChild(hotelName);hotelItem.appendChild(hotelPrice);hotelList.appendChild(hotelItem);});}).catch((error) => {alert('查询失败!请稍后重试。');console.error(error);});});
    本文由:成都民宿于(2024-11-06)发表了关于附近宾馆查询100米内最近的便宜酒店 (附近宾馆查询500米内50至60元)的文章 。如转载请注明出处:http://www.cdcy-mail.com

如果您对此感兴趣,可以通过以下联系方式与我们联系:

点击这里给我发消息成都区销售    点击这里给我发消息重庆区销售    点击这里给我发消息云贵区销售    点击这里给我发消息华南区销售 点击这里给我发消息华北区销售 点击这里给我发消息华东区销售

华为企业邮箱销售热线:400-0828-083

蜀ICP备11006316号-8

Copyright © 2025

版权所有 成都畅邮信息 xml txt html 成都民宿 知识园地 行业新闻 流量卡 成都民宿