> Looks like a case of "asynchronous-itis". You're reading the val() of
> the load()-ed div before the Ajax call has had a chance to respond.
>
> What you'll want to do is add the fancyBox stuff to the callback
> function for load() like this:

Leonard:

Thanks! You *were* on the right track with that advice. That was
definitely part of the issue.

The other issue was that we were trying to trigger two events
(FancyBox and .load()) on one DOM element.

The fix was a combination of your suggestion, and adding a second HTML
element that gets triggered from the first elements event.

HTML:

<img id="loadTrigger"  src="button.gif" /><a href="#divToDisplay"
id="fancyboxTrigger"></a>

jQuery:

$('#fancyBoxTrigger').fancybox({
                                'hideOnContentClick': false,
                                frameWidth: 660,
                                frameHeight: 700,
                                overlayOpacity: .6,
                                padding: 0
                });
        
                $('#loadTrigger').click(function(){
                        
$('#loadedContent').load('page.php',{'zip':$('#zip').val()},function(){$('#fancyBoxTrigger').click()});
                });

Whew!

-DA

Reply via email to