0

I have a site which uses Shadowbox-JS to bring up a settings page when a user clicks on a little icon. The settings are there for the user to be able to customise their view of what they're looking at in the main application.

The settings page is a full (but compact) .aspx page which has all the relevant code for the settings to be applied, updated to a database, read from a database etc, so that's all nicely dynamic. What I want is for a postback to occur once the user closes the shadowbox so that the view on the main page automatically updates to reflect their changes.

The following link appears once the user presses 'save' in the settings area:

<a onclick="window.parent.location.href = window.parent.location.href;">Settings saved.  Please close this window</a>

This basically just refreshes the whole page and of course, in the process the shadowbox is no more. This approach works fine but the problem is the user also has the option to close the shadowbox by clicking outside of it. I need to capture when this happens and cause a postback (or page refresh) when this happens so that no matter what the settings are always applied when the shadowbox is closed.

Arj
  • 1,981
  • 4
  • 25
  • 45

1 Answers1

0

I've found the answer, I needed to add an option to the Shadowbox.init() function as follows:

Shadowbox.init({
    onClose: function () {
        window.location.href = window.location.href;
    }
});
Arj
  • 1,981
  • 4
  • 25
  • 45