重力形成WEBAPI javascript输入名称,句点不起作用

时间:2016-11-18 05:09:18

标签: javascript forms gravity gravity-forms-plugin

我的字段名称存在问题,其中包含句点"."

如果字段名称类似于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);
});

0 个答案:

没有答案