我在WP网站上使用Gravity Forms.我的表单使用Pardot 表单处理程序通过ajax POST到Pardot.我遇到了Pardot处理表单6x的问题,没有其他错误.研究表明,这是因为Pardot不支持CORS或JSONP,因此在使用ajax提交时会陷入循环.当表单处理程序的成功URL设置为引用URL时,它正在处理提交但从未"完成".它在放弃之前尝试6次,处理提交的数据并每次发送新的潜在客户通知电子邮件.
Pardot 帮助文档建议以下解决方案:
通过将表单处理程序的成功和错误URL分别设置为执行成功和错误回调的JavaScript URL,可以模拟JSONP响应.
我不完全确定这意味着什么或如何处理它.我已经做了一些stackoverflowing和谷歌搜索,但我似乎无法绕过如何做到这一点.有人可以帮助澄清这个概念或指出我正确的方向吗?
谢谢!
我挣扎了大约一天,试图针对 Pardot API 进行身份验证。它不喜欢我尝试发布消息正文的方式。所以我想发布对我有用的解决方案。如果您有任何提示或替代方案,我想听听。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var url = "https://pi.pardot.com/api/login/version/3";
//(Edit) Shorter way to pass the parameters below
//var postData = new List<KeyValuePair<string, string>>
//{
// new KeyValuePair<string, string>("email", "<value>"),
// new KeyValuePair<string, string>("password", "<value>"),
// new KeyValuePair<string, string>("user_key", "<value>")
//};
var postData = new Dictionary<string, string>
{
{"email", "<value>"},
{"password", "<value>"},
{"user_key", "<value>"}
};
var httpContent = new FormUrlEncodedContent(postData);
using (var client = new HttpClient())
{
HttpResponseMessage response = client.PostAsync(url, httpContent).Result;
if (response.IsSuccessStatusCode)
{ …Run Code Online (Sandbox Code Playgroud)