For a deeper and customized integration we offer a JavaScript library that allows you to submit your forms using AJAX and handle the response in JavaScript. Using this method the user does not get redirected and stays on your page.

Add tinyforms.js to your page:

<script src="<https://www.tinyfor.ms/tinyforms.js>"></script>

Mark the form with the data-tinyforms attribute:

<form data-tinyforms id="tinyforms-example" method="POST" **action="<https://www.tinyfor.ms/s/jf2buT4wKKggERczyxfPSYMJ>"** enctype="multipart/form-data">
  <input type="text" name="name">
</form>

Now the form will get submitted using AJAX.

You can define an tinyforms:submittedevent listener to get a notification once the form was submitted:

Event listener:

var form = document.getElementById('tinyforms-example');
form.addEventListener('tinyforms:submitted', function(e) {
  console.log('Form submitted');
  alert('Thank you, ' + e.detail.submission.name); // the event detail.submission holds the submission data
});

Or you can define a callback in the tinyforms-submitted data attribute:

<form data-tinyforms="true" data-tinyforms-submitted="**myCallback**" id="tinyforms-example" method="POST" **action="<https://tinyforms.herokuapp.com/s/jf2buT4wKKggERczyxfPSYMJ>"** enctype="multipart/form-data">
  <input type="text" name="name">
</form>
<script>
  function **myCallback** (submission) {
		alert('Thank you, ' + submission.name);
  }
<script>

You can also use our API directly:

Tinyforms API