In my app on fancybox element click I am AJAX loading an html page. But on that remote page I also have some javascript logic that uses AJAX (I know it's weird) to load some data on page load. Right now I don't want to show fancybox dialog or just keep showing loading animation until the data inside the remote page is fully loaded. 
Is there a way to do that?

What I have so far is really ugly - I load an empty page that is shown in the fancybox dialog and after a few seconds the content on that page is loaded. And because of that I have issues with dimensions and centering.