Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no built in JavaScript event that triggers after all AJAX calls within iframes on the page have completed. </p> <p>There are a couple examples on handling iframe events here:</p> <ul> <li><a href="https://stackoverflow.com/questions/205087/jquery-ready-in-a-dynamically-inserted-iframe">jQuery .ready in a dynamically inserted iframe</a></li> <li><a href="https://stackoverflow.com/questions/164085/javascript-callback-when-iframe-is-finished-loading">Javascript callback when IFRAME is finished loading?</a></li> </ul> <p>Outside of that, you will need to keep track of each of your AJAX calls, and check if all of them have successfully completed after each individual completion. It would also probably be a good idea to set a timeout in case one of them fails or doesn't return an error.</p> <p>Here's a rough example.</p> <pre><code>// Keep track of your ajax content. var ajaxComplete1 = false; var ajaxComplete2 = false; var timeoutInterval; // For timeouts. // Check if everything is complete. function checkPageComplete() { if (ajaxComplete1 &amp;&amp; ajaxComplete2) { clearInterval(timeoutInterval); // Clear timeout. // Everything has loaded, do your initialization. } } // Wait for the main page to load. $(window).load(function() { // Wait 30 seconds for dynamic content to load. timeoutInterval = setInterval(function() { clearInterval(timeoutInterval); // Handle timeout. }, 30000); // Load the first content. $.ajax({ url: 'someurl', success: function(data, textStatus, jqXHR) { ajaxComplete1 = true; checkPageComplete(); }, error: function(jqXHR, textStatus, errorThrown) { // Handle error. } }); // Load the second content. $.ajax({ url: 'anotherurl', success: function(data, textStatus, jqXHR) { ajaxComplete2 = true; checkPageComplete(); }, error: function(jqXHR, textStatus, errorThrown) { // Handle error. } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload