Next snippet is supposed to show 10 <div>s, each displays the loading time. Loading time is the difference between endTime and startTime: startTime and endTime was given by javascript Date.getTime method at the time of 'loading' and 'complete' for each run of $i. But the calculated time is always 0, that is startTime and endTime are always the same values in the php for loop. I'm a newbie programmer and this might be a silly question, but I'd really like to know how to get load time in VakePHP AJAX operation. The action url '/test/content/?i=$i' usually takes 5 seconds for loading, but it is not reflected in the loadTime below.
<script type="text/javascript"> var now = new Date(); </script> <?php for ($i = 0; $i < 10; $i++){ $view = 'view' . $i; echo "<div id=$view></div>"; $options = array( 'update' => "$view", 'url' => "/test/content/?i=$i", 'type' => 'asynchronous', 'loading' => "Element.hide($view);startTime=now.getTime();", 'complete' => "Effect.Appear($view);endTime=now.getTime();loadTime=endTime- startTime;Element.update('$view','$i'+':'+loadTime);" ); echo $javascript->event('window','load',$ajax- >remoteFunction($options),false); } ?> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---