How to open/link new page in wix code

Hello,
I have a radio button
Depending to the choice, I just want to open a new page…

if ($w(“#bookingRadioGroup”).value === “multiCity”) {
=>> Open the page “Confirmation”;
}

I did not find the solution in the doc.

Can you please help?
Thx
Regards,
Pierre-yves

Hi Pierre-yves,

You can use wix-location.to() to navigate to the new page.

Here’s some sample code:

import wixLocation from 'wix-location'; 

if ($w("#bookingRadioGroup").value === "multiCity") {
    wixLocation.to("/Confirmation);
}

This is one way to do it, and should get you going.

Good luck,

Yisrael

Hello Yisrael,

Thanks for your help…
It is not working - Could it be an permission issue ?
Or the related page should be a sub-page ?

When I click to the link, the linking page did not open…

export function text2MultiLeg_click(event, $w) {
wixLocation.to(“/Contact_Member”);
}

Thanks again
regards,
pierre-yves

Hi,
Can you please share a link to your site so we can inspect ?
Roi

Hi Roi,

This is a “Members Only”. I guess you need a profile to test ?
Could the issue comes from the permission ?

Thx
regards,
pym

Hi,
No permissions are needed for wixLocation.to.
Just the link, No need a profile to test.
Roi

Dear Roi,
I finally found out the problem with your last comments… thanks.
The problem was the page has been initially built with a copy/paste and on the SEO page I did not change the url link which was not what i expected… oups…

Thx for your help !
regards,
pym

:slight_smile:

Thank you so much!

Hi Roi, I have a doubt in this. In my case, I need the navigation to be done to an another external link. Like when the value of bookingRadioGroup is multiCity, and the button submit is clicked, I want it to be navigated to www.wix.com in a separate tab. Kindly help me in this regard. Thanks in advance.

I also need a way to open a new internet tap with a given url link. Is there an easy way to do this?