I want to retrieve some data from a form via JavaScript, and have them in JavaScript variables
const value = document.getElementById("my-field").value;
After that I want to pass this client side JavaScript into AMPscript expression, so I can send data using ajax and will be sent encrypted ( client side )
// my variables has to replace the values of email, firstname, lastname, etc ..
var expression = '%%=CloudPagesURL(2102, "email", "edm@edm.com" , "firstname", "firstName", "lastname", "el second name")=%%'
xhttp.open("POST", expression, true);
//Send the proper header information along with the request
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.send();
Is there a way to do that?