Above is my code for sending form data to hubspot forms. Any idea what is the proper way to send form data to hubspot forms using client side?
Hello @ablayze_jb . Thanks for writing. Seems like the data you send is malformed, your formStepOne variable should contain a JSON object that has the name and value for the field, where the name is the actual field name and value its value you get from the form. It should look something like the following:
var formStepOne = {
"fields": [
{
"name": "firstname",
"value": ...
},
{
"name": "lastname",
"value": ...
},
...
]
}
Change or add the following : contentType : 'application/json', dataType : 'json',
Also add the headers: {"Content-Type" : "application/json"} setting.
Hope this helps, let us know how it went and if you need more help!
Also make sure to post the errors if you get any so it helps with debugging.
Cheers!
If my answer was helpful please mark it as a solution.
Why does the error show a “GET” request? Isn’t the “POST” request the issue here?
Its already working. i just noticed
its
method: “POST” (This one works for old version of jquery)
should be
type: “POST” (For new version of jquery)


