Submit Webflow Form to Backend

I have a form in webflow. I want to make a post request to send data to my server (using API end point).

Any tips how to fetch the data from webflow form and send to the backend without using any 3rd party tool, custom code only.

Thanks!

@Support-Luis please help me to solve this problem.

Hey @awaismahmood4! I believe Form Submit - No-code using Attributes could be helpful for this.

I also asked ChatGPT for some starting points and it replied with this code →

function submitForm() {
    // Fetch form data
    const formData = {
        name: document.getElementById('name').value,
        email: document.getElementById('email').value,
        // Add other form fields here
    };

    // Send data to the backend
    fetch('/your-backend-endpoint', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify(formData),
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }
        return response.json();
    })
    .then(data => {
        // Handle successful response from the server
        console.log('Success:', data);
    })
    .catch(error => {
        // Handle error
        console.error('Error:', error);
    });
}


Hey did you figure it out?

How to prevent the default behaviour of webflow form submission?

no idea. Could you please help me to solve this problem