wixLocation.to functionality

I am new to Wix code and JavaScript.
The following code is on my page code and shows no errors within the code section.


import wixLocation from ‘wix-location’;
export function button1_click(event) {
//Add your code for this event here:
wixLocation.to(“/Member Benefits”);
}


However, when I run the page (preview it) and I click on the button nothing happens . I get the following message in the Developer Console.
Loading the code for the Step 2:Platinum Plus page. To debug this code, open id8oi.js in Developer Tools.

I know it must be something simple. Any help greatly appreciated.

WixLocation dont work in preview mode and URL cannot consist of spaces. Try that in published.

Thank you. I will try that.

so how can we get a save url such that you’re able to test your javascript and rendering using preview (instead of putting crap live)?