Ich suche nach einer Möglichkeit, die Daten eines HubSpot-Formulars an die URL zu senden, an die es nach der Übermittlung weitergeleitet wird, damit ich Felder in einem benutzerdefinierten Formular auf dieser Seite automatisch ausfüllen kann. Ich habe versucht, die Daten in einem Cookie zu speichern, hatte aber kein Glück. Ich fand auch ein Skript auf Github für die Daten an den redirectURL anhängt und legen Sie es in meiner Zielseite Template-Code, aber nicht in der Lage gewesen, um es an die Arbeit:Verwenden von HubSpot-Formulardaten auf redirectURL
https://gist.github.com/axiak/2bf8f43d9d4a5f9c883f
/**
* Append the form data from a HubSpot form automatically
* to the redirect URL query parameters. These values can
* then be used on the form to modify the user experience
* of the Thank You page
*
* LICENSE
* Form redirect
* Written in 2015 by Mike Axiak <[email protected]>
* To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
* You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
(function() {
var $ = jQuery;
var appendFields = function (url, values) {
var data = {};
$.each(values, function (i, item) {
if (item.name !== "hs_context") {
data[item.name] = item.value;
}
});
if (url.match(/\?/)) {
return url + "&" + $.param(data);
} else {
return url + "?" + $.param(data);
}
};
$(function() {
$("body").on("submit", "form.hs-form", function (e) {
var $form = $(this);
var apiUrl = $form.attr("action");
var $hsContext = $("input[name='hs_context']", $form);
var hsContext = JSON.parse($hsContext.val());
hsContext.redirectUrl = appendFields(hsContext.redirectUrl, $form.serializeArray());
$hsContext.val(JSON.stringify(hsContext));
});
});
})();
Ich habe das Internet für genau die gleiche Sache gereinigt! –