<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);}}); script>