Javascript 为什么Hubspot无法获取任何表单数据?
我正在尝试发送一个post请求,以便当场提交表单数据。 API返回一条代码为200的成功消息和一条消息“表单已提交” 这是你的电话号码`Javascript 为什么Hubspot无法获取任何表单数据?,javascript,jquery,hubspot,hubspot-crm,Javascript,Jquery,Hubspot,Hubspot Crm,我正在尝试发送一个post请求,以便当场提交表单数据。 API返回一条代码为200的成功消息和一条消息“表单已提交” 这是你的电话号码` $("#basicForm").submit(function(e) { e.preventDefault(); // avoid to execute the actual submit of the form. var data = new FormData($('#basicForm')[0]); var
$("#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);
}
});
});
`
以下是HTML表单:
<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>
姓名:
电邮:
我收到一条成功消息作为回报,但HubSpot显示“未提交任何字段”。是否检查提交时发送的请求标题?你能用这些来编辑你的帖子吗?接受:/Content-Type:application/json-Origin:Referer:User-Agent:Mozilla/5.0(Macintosh;英特尔Mac OS X 10_13_3)AppleWebKit/537.36(KHTML,像Gecko)Chrome/68.0.3440.106 Safari/537.36我需要在标题中发送其他东西吗?我的错了,我想请求正文(我回答得太快了,在chrome开发工具中也是如此)。编辑你的答案,而不是把这些东西放在评论中。