[thelist] jquery and iFrame loading complete

Scott Brady dsbrady at gmail.com
Thu Jun 3 09:46:57 CDT 2010


I have an iFrame that does some processing that doesn't generate any HTML
output.  It processes a data export and then delivers that file to the user.

What I'd like to do is run some JS processing in the parent document once
the processing is done (I can't really add any javascript inside the iframe,
because it's not loading HTML.).  I thought I could attach a function using
.ready(), but that seems to fire immediately, even if the processing isn't
done yet.  I tried adding an onload in the iframe tag directly, but that
doesn't seem to fire in this case (if the iframe generates HTML output, it
does).

I think I'm missing something pretty simple here.

Here's some code:
The iframe HTML:
    <iframe width="0" height="0" src="about:blank" id="dataProcessingIFrame"
onload="processingComplete()"></iframe>

The processingComplete function:
function processingComplete()
{
    alert(3);
}

Other javascript (this is all contained inside a function used when a user
clicks an item to start processing)
    $('#dataProcessingIFrame').ready
    (
        function()
        {
            alert('done');
        }
    );

    $("#exportMeetRegistrationsLoadingDiv").show();
    $("#exportMeetRegistrationsContentDiv").hide();
    var exportURL = baseURL + exportMeetRegistrationsXFA + '&swimMeetID=' +
swimMeetID;
    $('#dataProcessingIFrame').attr('src',exportURL);


I tried changing the .ready() to a .load() but it doesn't fire at all (nor
does the inline onload when the processing runs).


Any ideas?

Scott
-- 
-----------------------------------------
Scott Brady
http://www.scottbrady.net/


More information about the thelist mailing list