After users click the button to submit their form i would like the page to reload.
I use this code, page name is “Test”, but something isn’t working - it is not reloading.
Any help is appreciated thank you.
import wixLocation from ‘wix-location’;
export function button1_click(event, $w) {
$w(‘#dataset1’).setFieldValue(‘username’,$w(‘#input1’).value);
$w(‘#dataset1’).save();
wixLocation.to(“/test”);
}
@jonatandor35 Thank you my code now works. Can you elaborate further on the .then() The only problem i have now is that the page reloads so fast that the user can not see the success or failure message linked to the button. Is there a way i can slow down the code by a couple seconds?
import wixLocation from ‘wix-location’;
export function button1_click(event, $w) {
$w(‘#dataset1’).setFieldValue(‘username’,$w(‘#input1’).value);
$w(‘#dataset1’).save();
wixLocation.to(“https://dcaffery900.wixsite.com/mysite-1/blank”).then();
}