Sending submissions with AJAX

If you don't want to redirect the user after they submit the form or want to add extra validation logic to your form, you might want to consider using JavaScript to submit. With Getform, you can send your form data with AJAX. Here's an example code block you can use:

See the Pen HTML Ajax Form Example & File Upload by Getform (@getform) on CodePen.

Note: If you want to get your responses in JSON form, you need to add dataType: "json" , it sets Accept Http Header to application/json

After that you can add id="ajaxForm" to your HTML form to finish the setup like this:

<form id="ajaxForm" action="{your-endpoint}" method="POST">

    <input type="text" name="name" id=”name”>
    <input type="email" name="email" id=”email”>
    <button type="submit">Send</button>


That's it! You can now send your form submissions using AJAX.