我的字段名称存在问题,其中包含句点"."
如果字段名称类似于input_1 or input_1_2
但是当它类似于input_1.2
时,它不起作用。
function CalculateSig(stringToSign, privateKey){
//calculate the signature needed for authentication
var hash = CryptoJS.HmacSHA1(stringToSign, privateKey);
var base64 = hash.toString(CryptoJS.enc.Base64);
return encodeURIComponent(base64);
}
var d = new Date;
var expiration = 3600;
var unixtime = parseInt(d.getTime() / 1000);
var future_unixtime = unixtime + expiration;
var publicKey = "mupubkey";
var privateKey = "pyprikey";
var method = "POST";
var route = "forms/6/submissions";
stringToSign = publicKey + ":" + method + ":" + route + ":" + future_unixtime;
sig = CalculateSig(stringToSign, privateKey);
var url = 'https://www.localhostlbahblah.com/gravityformsapi/' + route + '?api_key=' + publicKey + '&signature=' + sig + '&expires=' + future_unixtime;
var values = {input_values:{'input_1.3':"test",// not working first name value
"input_2":"testetest", // this is working
}}
values_json = JSON.stringify(values);
$.post(url, values_json, function(data){
console.log(data.response);
});