<form><input id="firstName" name="firstName" type="text" placeholder="First Name"><input id="lastName" name="lastName" type="text" placeholder="Last Name"><input id="email" name="email" type="text" placeholder="Email"><button id="button" class="button" onclick="returnData()">Next</button></form><script runat="server"> function returnData() { var email = document.getElementById("email").value; } Platform.Variable.SetValue(@email, "email");</script>%%=v(@email)=%%
I am trying to pass a javascript variable to ampscript but it's not working. I'm not submitting the form but adding a saved button to capture the email. Below is the code I used. Where am I going wrong? My form is in the comment section.
<form><input id="firstName" name="firstName" type="text" placeholder="First Name"><input id="lastName" name="lastName" type="text" placeholder="Last Name"><input id="email" name="email" type="text" placeholder="Email"><button id="button" class="button" onclick="returnData()">Next</button></form>