I am using fancybox to show an iFrame containing a form. When the form is submitted I close fancybox like so:
parent.jQuery.fancybox.close();
I then do some AJAX stuff on the afterClose
event.
The problem I'm having is that if someone closes fancybox by clicking the close button or clicking the dimmer outside the fancybox then it still calls the AJAX function in the afterClose
function.
How do I detect how fancybox has been closed and only run the afterClose
function if fancybox has been closed like this:
parent.jQuery.fancybox.close();
I still need to give my users the option to close the fancybox so I cannot disable the close button.
UPDATE
Looking at the fancybox object I can see the afterClose
function has a number of values:
Is it possible to update the caller
value to something I can check once the afterClose
function has fired? How would I do this?