Initial Commit
This commit is contained in:
21
indexes/user/stays.js
Normal file
21
indexes/user/stays.js
Normal file
@@ -0,0 +1,21 @@
|
||||
document.getElementById('searchForm').addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Serialize the form data
|
||||
var formData = new FormData(this);
|
||||
|
||||
// Perform the AJAX request to the server
|
||||
fetch('search_hotels.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(hotels => {
|
||||
// Process the returned hotel data
|
||||
console.log(hotels); // For debugging purposes
|
||||
// You will need to write code to display the hotels on the page
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user