I do not know much javascript and I am trying to pull in a form's input values, construct the link to pass the values to and send the user to that link on button click.
I am not sure how to make both of those actions happen onClick.
Here is what I currently have:
<script>
function myFunction() {
var firstname = document.getElementById("firstname").value;
var lastname = document.getElementById("lastname").value;
var email = document.getElementById("email").value;
var phone = document.getElementById("phone").value;
var link = 'https://app.squarespacescheduling.com/schedule.php\?owner=21917237&appointmentType=20129186&firstName=' + firstname + '&lastName=' + lastname + '&email=' + email + '&phone=' + phone;
}
</script>
And this is what I am trying inline with my button element:
<div class="de elBTN elAlign_center elMargin0 ui-droppable de-editable" id="tmp_button-86409" data-de-type="button" data-de-editing="false" data-title="button" data-ce="false" data-trigger="none" data-animate="fade" data-delay="500" style="margin-top: 30px; outline: none; cursor: pointer; display: block;" aria-disabled="false" data-elbuttontype="1">
<a onclick={myFunction(), onclick="location.href=link;"} class="elButton elButtonSize1 elButtonColor1 elButtonRounded elButtonPadding2 elBtnVP_10 elButtonCorner3 elBtnHP_25 elBTN_b_1 elButtonShadowN1 elButtonTxtColor1 elButtonFull" style="color: rgb(255, 255, 255); font-weight: 600; background-color: rgb(1, 116, 199); font-size: 26px;">
<span class="elButtonMain"><i class="fa_prepended fa fa-angle-double-right"></i>Let's Get Started<i class="fa_appended fa fa-angle-double-left"></i></span>
<span class="elButtonSub"></span>
</a>
</div>
I need to send the user to the link created in var link. What's the best way to have this happen?
Thanks!