Hey there,
I don’t know code. What i want is for my users to be redirected to a Thank you page or home page. wixLocation doesn’t seem to work.
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(‘#submit’).onClick( function () {
let emails = ; let labels = ;
emails.push($w('#email').value);
const age = $w(‘#age’).value;
// calculate the proper age label if (age < 18) {
labels.push(“Below 18”);
} else if (age < 25) {
labels.push(“18 - 24”);
} else if (age < 36) {
labels.push(“25 - 35”);
} else {
labels.push(“Above 35”);
}
// register as member using form data
wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“emails”: emails,
“labels”: labels,
“age”: Number($w(‘#age’).value)
@jonatandor35 Hey, Thank you for replying. I Should confess I am really bad at code. So this is what I did and it’s giving me a parsing error (Don’t know what this means).
import wixUsers from ‘wix-users’; import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(‘#submit’).onClick( function () {
let emails = []; let labels = [];
emails.push($w('#email').value);
const age = $w(‘#age’).value;
// calculate the proper age label if (age < 18) {
labels.push(“Below 18”);
} else if (age < 25) {
labels.push(“18 - 24”);
} else if (age < 36) {
labels.push(“25 - 35”);
} else {
labels.push(“Above 35”);
}
// register as member using form data
wixUsers.register($w(‘#email’).value, $w(‘#password’).value,
.then( () => {
wixLocation.to(“/home”); })
{
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“emails”: emails,
“labels”: labels,
“age”: Number($w(‘#age’).value)
}
});
//Change the URL ending to whatever page you want to send the user to after they log in
import wixUsers from ‘wix-users’; import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(‘#submit’).onClick( function () {
let emails = []; let labels = [];
emails.push($w('#email').value);
const age = $w(‘#age’).value;
// calculate the proper age label if (age < 18) {
labels.push(“Below 18”);
} else if (age < 25) {
labels.push(“18 - 24”);
} else if (age < 36) {
labels.push(“25 - 35”);
} else {
labels.push(“Above 35”);
}
// register as member using form data
wixUsers.register($w(‘#email’).value, $w(‘#password’).value, {
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“emails”: emails,
“labels”: labels,
“age”: Number($w(‘#age’).value)