File manager - Edit - /home/asiatechinc/public_html/asiatech-websites/indogoanhospitality.com/test.php
Back
<!DOCTYPE html> <html> <head> <title>Booking Chatbot</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <h1>Booking Chatbot</h1> <div id="chat-container"> <div id="chat-log"></div> <input type="text" id="chat-input" placeholder="Type your message..." autocomplete="off"> </div> <script> $(document).ready(function () { // Display a welcome message from the chatbot displayMessage("Chatbot: Welcome! How can I assist you today?"); // Handle user input $("#chat-input").keypress(function (event) { if (event.which === 13) { var userInput = $(this).val(); $(this).val(""); displayMessage("You: " + userInput); processUserInput(userInput); } }); }); function displayMessage(message) { $("#chat-log").append("<p>" + message + "</p>"); } function processUserInput(userInput) { // Perform the necessary processing based on user input // You can implement the logic for handling different user queries, such as booking requests, etc. // Here's a simple example for booking requests if (userInput.toLowerCase().includes("book")) { displayMessage("Chatbot: Sure! Please provide me with your name, email, and check-in date."); } else if (userInput.toLowerCase().includes("name")) { displayMessage("Chatbot: Great! Now, please enter your email address."); } else if (userInput.toLowerCase().includes("email")) { displayMessage("Chatbot: Perfect! Finally, enter your preferred check-in date."); } else if (userInput.toLowerCase().includes("date")) { displayMessage("Chatbot: Thank you for the information. Your booking has been submitted. We will contact you soon."); submitBooking(userInput); // Send the booking details to the server } else { displayMessage("Chatbot: I'm sorry, I couldn't understand your request. Can you please rephrase?"); } } function submitBooking(userInput) { // You can use AJAX or any other method to send the booking details to the server // Replace the URL below with the appropriate endpoint on www.indogoanhospitality.com for submitting bookings var endpoint = "https://www.indogoanhospitality.com/api/bookings"; // Assuming the booking details are sent as JSON var bookingDetails = { userInput: userInput }; // Send the booking details to the server $.ajax({ url: endpoint, type: "POST", data: JSON.stringify(bookingDetails), contentType: "application/json", success: function (response) { console.log("Booking submitted successfully:", response); }, error: function (error) { console.error("Error submitting booking:", error); } }); } </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings