I am trying to send a post request to submit the form data on HubSpot. API returns a success message with code 200 and a message 'Form has been submitted'.
Here is the `
$("#basicForm").submit(function(e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var data = new FormData($('#basicForm')[0]);
var form = $(this);
$.ajax({
type: "POST",
url: 'https://api.hsforms.com/submissions/v3/integration/submit/4848030/3d98fe1e-278b-4915-9c81-5b69206a4b4f',
cache: false,
contentType: false,
processData: false,
headers: {
'Content-Type':'application/json'
},
data: JSON.stringify(data),
success: function(data) {
console.log(data);
},
error:function(e){
console.log(e);
}
});
});
`
Here is HTML Form:
<form id = "basicForm">
Name: <input type = "text" value = "ss@hh.com" placeholder="Name" name = "name">
Email: <input type = "email" value = "ss@hh.com" name = "email" placeholder="Email">
<input type = "submit">
</form>
I get a success message in return but HubSpot shows 'No fields were submitted.'