javascript - Refresh page after everything is loaded every 15 seconds -


i when page refreshed automatically every 15 seconds, loaded once. tried code doesn't work.for example when image large,i not want see image loading slowly,i want page loaded(images, tables) in background,and see changes once.any ideas ? tried code not work expected.

<script> function autorefresh1() { window.settimeout(function(){ document.location.reload(true); }, 15000); } </script>  <body onload="autorefresh1();"> 

after following links in comments came solution solves problem

<script type="text/javascript"     src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script>     $(document).ready(             function() {                 setinterval(function() {                 $('#table').load("table.html");                 }, 15000);             }); </script> 

and div inside :

<div id="table" align="center"></div> 

you can check see if page loaded document.readystate.

there many ways go doing this, have css box overlay entire page "loading" message. while loading message up, use setinterval() check document.readystate. when readystate returns complete, clear initial setinterval(), hide loading message, reveal rest of page.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -