Update Page On Lightbox Close?

Hello!
I’m having a user upload a file via a lightbox window, when the lightbox window closes, I would like to refresh a dynamic dataset on the page.

Is there a way to have the lightbox communicate with the base page so that I can update the data on lightbox close?

Thanks!

just add code to your lightbox to refresh the page and then close the lightbox

import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;

$w.onReady( function () {

//add an event here such as an onClick to trigger the page refresh and lightbox close

wixLocation.to (wixLocation.url);

wixWindow.lightbox.close();

})

Another idea is after the user uploads the file the user is directed to a success page saying thank you for uploading, then there‘S a button on the success page that says see results or whatever is being displayed in the database and its linked to that page. So it can act as a way to refresh the page and as a success message without using code. Make sure the success page is a dynamic page because it doesn’t work with regular pages.