Help with page redirect!

@salman_badshah

So you are following this tutorial here.
https://support.wix.com/en/article/corvid-tutorial-creating-a-custom-registration-form-with-code

Well first thing to note is that Wix Users doesn’t work in preview mode, to test it properly you need to be using your live published site only.

The APIs in wix-users are only partially functional when previewing your site. View a published version of your site to see their complete functionality.
https://www.wix.com/corvid/reference/wix-users.html

As for your code.
Your submit click underneath your pages onReady function should be
$w(‘#submit’).onClick( () => {
Which includes the onClick event handler in the code itself.

Whereas you have it setup as this
$w(’ #submit ').onClick( function () {
Which is setup as through the event handler in the properties panel for the element and it should be setup something like this instead with an export function.
export function profilebutton_onclick(event) {
wixLocation.to(/Members/${wixUsers.currentUser.id});

Then as J. D. first tells you and provides you with the link for you to see the code in the API reference itself, which then Be shows you in code, it should have the .then results code underneath your register’s contact info.
}
} )
.then( (result) => {
let resultStatus = result.status;
} );
And into that you can add your wix location call to take you to your other page, however you need to make sure that you close your open lightbox first.

.then( (result) => {
let resultStatus = result.status;
wixWindow.lightbox.close();
wixLocation.to(“/yourpageURLhere”); //Change the URL ending to whatever page you want to send the user to after they log in.