AJAX Submission

How to submit submissions from your static websites with AJAX


You can submit your forms with AJAX. To make an AJAX request set the Accept header to application/json.

Here is some implementation example with Axios. Axios is promise based HTTP client for the browser and node.js.

Making JSON request with Axios

axios({
method: 'POST',
url: 'https://api.formcubes.com/submission/{your-form-id}',
headers: {
'Accept' : 'application/json'
},
data: {
email: "email@axample.com",
name: "jhon",
message: "hello my name Jhon Doe"
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});

Making x-www-form-url-encoded request with Axios

axios({
method: 'POST',
url: 'http://api.formcubes.com/submission/{your-form-id}',
headers: {
'Accept' : 'application/json'
},
data: "email=email@example.com&name=Jhon+Doe&message=hello+my+name+is+Jhon+Doe"
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});

Try free for 7 days

Start collecting submissions with a free 7-day trial.
No credit card required.