JavaScript Contact Form (AJAX, no page reload)
A JavaScript contact form that submits in the background, shows success inline, and never reloads the page. ~30 lines of vanilla code.
The traditional HTML form posts and reloads the page — you lose scroll position, animations replay, and the user gets the jarring 'Thanks!' page. AJAX submission with the Fetch API is two extra event listeners — one to preventDefault on submit and one to render the success state. We give you the snippet.
- →Basic contact form · 4 fields
- →HTML, JS, React, PHP, cURL outputs
- →One POST endpoint, no SDK
- →Honeypot + classifier, no CAPTCHA
See exactly what your visitors see — and you’ll receive.
Left: the rendered form, fully interactive in a sandboxed iframe. Right: the email and dashboard view that lands the moment a visitor submits.
Every submission becomes an email plus a dashboard row. The fields below are the exact payload your form will send. Reply-to is wired to the visitor’s email so hitting reply goes back to them.
Iframe is sandboxed — submit doesn’t actually fire. Get your access key to wire it up live.
Generate, embed, receive.
Three actions stand between you and your first lead. None of them require a backend, a database, or a CAPTCHA library.
Hook the submit event
Listen for 'submit' on the form, call e.preventDefault(), then send a fetch() POST with the FormData. splitforms returns JSON, so you can branch on success/error.
Handle success and error states
On success, hide the form and show a thank-you message. On error, surface the error message inline so the user can retry without losing their input.
Optional: validation before send
You already get HTML5 required attributes for free. Add custom validation in the submit handler if you want regex-based email checks or business-logic gates.
Five outputs. One backend.
HTML by default. Click open the language you ship in — every variant POSTs to the same /api/submit endpoint.
Replace YOUR_ACCESS_KEY with the key from your dashboard. That’s the only edit.
One template. Every framework.
The same field set works on every framework splitforms supports. HTML, React, Next.js, Vue, Astro, Hugo, WordPress — same POST, same backend.
Things people ask before they ship.
Direct answers, no marketing fluff. Missing one? Email hello@splitforms.com.
Ship your javascript contact form (ajax, no page reload) in 60 seconds.
1,000 free submissions per month. No credit card. Copy the snippet, paste your access key, watch leads land in your inbox.