[SOLVED] Need help auto-refreshing Dataset

Example :

Hi there, I want to have a live updating dynamic page where the user doesn’t have to refresh the page, but instead will automatically update every 15secs.

I found this code:

import wixLocation from 'wix-location';
$w.onReady(function () {
setTimeout(() => wixLocation.to(wixLocation.url), 15000)//TIME IN MILLISECONDS
})

That’s fine and works. But my problem now is that there is a video player on the site and I want that to keep playing uninterrupted while the data connected elements auto update to the latest data live.

I then tried combining the code above with this code:

$w.onReady( () => {
  $w("#myDataset").onReady( () => {
    $w("#myDataset").refresh()
      .then( () => {
        console.log("Done refreshing the dataset");
      } );

  } );

} );

To create this:

$w.onReady(function () {
setTimeout(() => $w("#dynamicDataset").refresh()), 5000
})

But that didn’t work.


Any help would be great, I’m quite new to this but want to get it working asap!

You need to use setInterval instead of setTimeout.

Also you have a syntax error.
It should be:

setInterval($w("#dynamicDataset").refresh, 5000);