Submit a form with Ajax and keep visitors on the page
A full page reload after Send feels dated, and you don't need jQuery to avoid it. The script below catches the submit, posts to your Formbold endpoint with fetch and writes a status line under the button. You still get every entry by email.
How do I submit a form with Ajax?
Catch the submit event, send the fields with fetch, then show the result. This snippet does all three in about 40 lines of plain JavaScript, no jQuery. Replace FORM_ID with your own.
What are the setup steps?
The only fiddly part is the Accept header. Leave it in.
Make a form in the dashboard
Click Create New Form and give it a name you'll recognise later. Free accounts can have 10.
Paste the endpoint
Put https://formbold.com/s/FORM_ID from Form Setup in the fetch call. Keep the Accept: application/json header so the script can read the response.
Test it
Submit once with the Network tab open. A 200 response means it worked, and the entry is already in Submissions.
After the request lands
It stores the entry, runs your spam settings, sends the email and passes the data to any connected apps, then replies to your script.
No backend script
No PHP handler or Node server behind the form. Your page and one fetch call are the whole stack.
Custom reCAPTCHA for fetch
Automatic reCAPTCHA is built for plain HTML posts. For an Ajax form, use Custom reCAPTCHA with your own v2 keys, plus Basic Spam Filter.
File uploads
Send a FormData body without a Content-Type header and files come through. Starter and higher.
Hand entries to other tools
From Starter, Formbold can forward each entry to Discord, Zapier, Make or your own webhook, so your script never has to.
Ajax form questions
The usual stumbling blocks, and how to get past them.
Still have a question?
The docs cover setup, framework guides, integrations and spam protection, step by step.