Start Date:
  


  End Date:
  


  Destination:
  


  Type of Adventure:
  
    Hiking
    Beach
    City Tour
  


  Type of Cuisine:
  
    Local
    International
  


  Budget:
  


  Transportation:
  
    Flight
    Train
    Bus
  


function wpb_hook_javascript() {
  if (is_page ('495-2')) { 
    ?>
        <script type="text/javascript">
function generateItinerary() {
  // Get form data
  const startDate = document.getElementById("start-date").value;
  const endDate = document.getElementById("end-date").value;
  const destination = document.getElementById("destination").value;
  const adventureType = document.getElementById("adventure-type").value;
  const cuisineType = document.getElementById("cuisine-type").value;
  const budget = document.getElementById("budget").value;
  const transportation = document.getElementById("transportation").value;

  // Send form data to ChatGPT API
  const apiEndpoint = "https://api.chatgpt.com/generate-itinerary";
  const requestBody = {
    startDate: startDate,
    endDate: endDate,
    destination: destination,
    adventureType: adventureType,
    cuisineType: cuisineType,
    budget: budget,
    transportation: transportation
  };
  const requestOptions = {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer OPENAI_API_KEY"
    },
    body: JSON.stringify(requestBody)
  };
  fetch(apiEndpoint, requestOptions)
    .then(response => response.json())
    .then(data => {
      // Display generated itinerary on HTML page
      const itinerary = data.itinerary;
      const itineraryContainer = document.getElementById("itinerary-container");
      itineraryContainer.innerHTML = itinerary;
    })
    .catch(error => console.log(error));
}
        </script>
    <?php
  }
}
add_action('wp_head', 'wpb_hook_javascript');