Fetching verified real-time rates via TripAdvisor API
Choose Departing Flight
18 flights from New Delhi (DEL) to John F. Kennedy International (JFK)
1
Departing Flight
Selecting outbound flight
โ
2
Returning Flight
Select step 1 first
Flight Itinerary & Details
Property Locations Map View
Canonical booking referencecanonical numeric location IDNo ticket is reserved by this request; ticket purchase is unavailable here. /api/search-flights
document.addEventListener('DOMContentLoaded', () => {
const searchInput = document.querySelector('input[name="origin"], input[type="text"], #flight-origin, .search-input-field');
// Adjust selector above to match your actual search input ID or class
if (!searchInput) return;
// Create dropdown container dynamically if it doesn't exist
let dropdown = document.getElementById('custom-autocomplete-dropdown');
if (!dropdown) {
dropdown = document.createElement('div');
dropdown.id = 'custom-autocomplete-dropdown';
dropdown.style.cssText = `
position: absolute;
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 8px;
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
max-height: 350px;
overflow-y: auto;
z-index: 9999;
width: ${searchInput.offsetWidth}px;
display: none;
margin-top: 4px;
`;
searchInput.parentNode.style.position = 'relative';
searchInput.parentNode.appendChild(dropdown);
}
let debounceTimer;
// Listen to typing events
searchInput.addEventListener('input', (e) => {
const query = e.target.value.trim();
clearTimeout(debounceTimer);
if (query.length < 2) {
dropdown.style.display = 'none';
return;
}
debounceTimer = setTimeout(async () => {
try {
// Call your FastAPI backend autocomplete endpoint
const response = await fetch(`https://flight-backend-production.up.railway.app/api/destinations/autocomplete?q=${encodeURIComponent(query)}`);
const data = await response.json();
const items = data.data || data.results || data; // Adjust based on your API response structure
if (!items || items.length === 0) {
dropdown.style.display = 'none';
return;
}
// Render suggestions with badges
dropdown.innerHTML = items.map(item => `