Submit forms with AJAX

Collect submission data from your NoCodeForm endpoints with AJAX

Overview

AJAX is a JavaScript technique which allows web pages to be updated asynchronously by exchanging data with a web server in background. This means that it is possible to update parts of a web page without reloading the page.

You can use AJAX to sumbit NoCodeForm submissions which also works cross-origin.

Axois

You can also use Axios library to submit form data:

axios({
  url: 'https://nocodeform.io/f/{your-form-id}',
  method: 'POST',
  headers: {
    'Content-type': 'application/json'
  },
  data: {
    email: '[email protected]',
    message: "Hello World"
  }
}).then((response) => {
  console.log(response);
})

JavaScript XHR

JavaScript XHR is another way of submitting form data which is supported by most web browsers:

const xhr = new XMLHttpRequest();
xhr.open("POST", "https://nocodeform.io/f/{your-form-id}");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.send(
  JSON.stringify({
    email: '[email protected]',
    message: "Hello World"
  })
);

jQuery AJAX

jQuery $.ajax can also be used to submit form data:

$.ajax({
  url: "https://nocodeform.io/f/{your-form-id}",
  method: "POST",
  dataType: "json",
  data: {
    email: '[email protected]',
    message: "Hello World"
  }
});