import { fetch } from 'wix-fetch';
$w.onReady(function () {
// Replace with your form ID
$w("#travelPlannerForm").onWixFormSubmitted((event) => {
const formData = event.formData;
// Send to your Pipedream webhook
fetch('https://eo1dss0ynom1mj.m.pipedream.net', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
destination: formData.destination,
startDate: formData.startDate,
endDate: formData.endDate,
travelers: formData.travelers,
budget: formData.budget,
travelStyle: formData.travelStyle,
interests: formData.interests,
accommodation: formData.accommodation,
email: formData.email,
name: formData.name,
timestamp: new Date().toISOString()
})
})
.then(response => response.json())
.then(data => {
console.log('Travel plan generated:', data);
// You can redirect to a results page or show success message
$w("#successMessage").show();
})
.catch(error => {
console.error('Error:', error);
$w("#errorMessage").show();
});
});
});
top of page
bottom of page