Redirect to URL in a URL field

OK, I realized my code didn’t match your sample code. So I updated to below and still error message during preview. But live the page loads but does not redirect. I put the text of the URL field and ID field on the page and they both show on the page.

$w("#dataset1").onReady(() => { 
    let currentItem = $w("#dataset1").getCurrentItem();
    let link = currentItem.url;
    wixLocation.to(link);
})