How to add a form to JavaScript (no page reload)

Add one script tag and mark your form with data-formtango. It sends in the background and shows a message, with no code to write.
  1. 1

    Create a free FormTango account and add a form. Copy its endpoint, which looks like https://formtango.com/f/YOUR_FORM_ID.

  2. 2

    Add the script and the form below, replacing YOUR_FORM_ID.

  3. 3

    Submit the form once. The submission appears in your FormTango inbox and you get an email.

html
<script src="https://formtango.com/formtango.js" defer></script>

<form data-formtango="YOUR_FORM_ID" data-success="Thanks! We'll be in touch.">
  <label>Email <input type="email" name="email" required></label>
  <label>Message <textarea name="message" required></textarea></label>
  <button type="submit">Send</button>
</form>

Good to know

  • The script adds the spam trap for you and records UTM tags and the referring page.
  • Style the message with the selector [data-formtango-status]. It carries data-state="success" or "error".
  • If JavaScript is switched off, the form still sends the ordinary way.

What you get

  • Every submission saved in an inbox you can search and export.
  • An email for each one, with the visitor's address as the reply-to.
  • Spam filtering without making visitors solve a puzzle.
  • Problems? See troubleshooting.

Related guides

HTMLReactNext.jsAstroVue

Last reviewed November 19, 2026.