Unstoppable Domains โ€” Get your daily AI drops report

Please Wait, Calculating...

SpaceshipSpaceship
Watch

Tree

Established Member
Impact
9
I have a page where a lot of charts and graphs are calculated. It can sometimes take 30 seconds or so for the calculations to finish and the charts to be displayed. How can I make it so it displays a message while the charts are calculating. Then when they're done, display them.

I have this code that Jim_ gave me:

PHP:
echo "<div id=\"hidelater\"><b><img src='pages/style/loadingcircle.gif'>  Please Wait, Calculating Chart Output. </b></div>
<script>
function tensecs() { document.getElementById(\"hidelater\").innerHTML = '<b><img src=\"pages/style/loadingcircle.gif\">  This can take quite a long time if more than four ads are selected. Please be patient.</b>'; }
window.setTimeout('tensecs()',10000);</script>"; 
ob_flush(); flush();

// Over 300 lines of chart calculations

echo "<script>document.getElementById(\"hidelater\").style.display = 'none';</script>";

But the charts still display as they're loaded, and when they finish, the little message doesn't go away.

Any help would be appreciated :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
If the problem is that the charts are showing up before they are done, don't echo them.

Do something like (where you have // Over 300 lines of chart calculations):

PHP:
<?php

$output = '';

// The 300 lines of chart calculations
$output .= 'The stuff you echoed before, but are now adding to this variable';

echo $output;

?>

This way, it only echo's one time so nothing will show up until you echo it.
 
0
•••
It's showing one chart, then the next one finishes calculating and it pops up, and it all looks very... not good.

Thanks for the idea though. Think I'll try it. :)

But I also get this error :(

Code:
We're glad that you're fond of this member, but please give some rep points to some other members before giving it to Dan Friedman again.
;)

Thanks Dan, that worked beautifully :)
 
0
•••
OMG, your fond of me. ;)

NP.
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back