Posted By

mariraj on 03/18/11


Tagged


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

skywalker
AllKnightAccess
Kurt
Priestd09


Auto refresh div using jquery


 / Published in: PHP
 

  1. <html>
  2. <head>
  3. <!-- For ease i'm just using a JQuery version hosted by JQuery- you can download any version and link to it locally -->
  4. <script src="jquery-1.3.2.min.js"></script>
  5.  
  6. <script>
  7. $(document).ready(function() {
  8. $("#responsecontainer").load("response.php");
  9. var refreshId = setInterval(function() {
  10. $("#responsecontainer").load('response.php?randval='+ Math.random());
  11. }, 9000);
  12. });
  13. </script>
  14. </head>
  15. <body>
  16.  
  17. <div id="responsecontainer">
  18. </div>
  19. </body>
  20.  
  21. --------------------------------
  22.  
  23. response.php :
  24.  
  25. <? echo rand(); ?>

Report this snippet  

You need to login to post a comment.