<script>
const form = document.getElementById("form");const results = document.getElementById("results");form.addEventListener("submit", (e) => {e.preventDefault();const location = document.getElementById("location").value;if (location.length === 0) {alert("请输入您的位置!");return;}// 发起请求获取旅馆信息fetch(`[API URL]${location}`).then((res) => res.json()).then((data) => {if (data.length === 0) {results.innerHTML = "
`;});results.innerHTML = output;}).catch((error) => {alert("请求失败,请稍后再试!");console.error(error);});});
script>
郑重声明:本文由:
民宿新闻于(2024-10-15)发表了关于
寻找附近的旅馆 (寻找附近的旅游景点)的文章。如转载请注明出处!部分文章来源于网络,仅作为参考,如果网站中图片和文字侵犯了您的版权,请联系我们处理!