Status
Not open for further replies.

travelmate

Active Member
48
2011
4
0
Hi !

I want to have auro refresh every 1 minute on of my web page but i am looking with some way to we don't see when the page reload. I want to we see the changes in the page but without reload the full page.

How can i do that ? Ajax or how ?

Thanks
 
9 comments
Code:
javascript: timeout=prompt("Set timeout [s]"); current=location.href; if(timeout>0)   setTimeout('reload()',1000*timeout); else   location.replace(current); function reload(){   setTimeout('reload()',1000*timeout);   fr4me='<frameset cols=\'*\'>\n<frame src=\''+current+'\'/>';   fr4me+='</frameset>';   with(document){write(fr4me);void(close())}; }


save that as a bookmark in your bookmark bar and click it on the page
you should get this message


tmp43b.png
 
I use this sexy code:

Demo Link

PHP:
<html>
<head>
<!-- For ease i'm just using a JQuery version hosted by JQuery- you can download any version and link to it locally -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
 $(document).ready(function() {
      $("#responsecontainer").load("response.php");
   var refreshId = setInterval(function() {
      $("#responsecontainer").load('response.php?randval='+ Math.random());
   }, 9000);
   $.ajaxSetup({ cache: false });
});
</script>
</head>
<body>
 
<div id="responsecontainer">
</div>
</body>





Source
 
Here's a tutorial we've used in the past from: http://wowjava.wordpress.com/2010/0...-content-without-reloading-page-using-jquery/


Code:
<html>
	<head>
		<Title>Just A Test</Title>
		<script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript">
        var auto_refresh = setInterval(
        function ()
        {
        $('#load_me').load('showdata.jsp').fadeIn("slow");
        }, 10000); // autorefresh the content of the div after
                   //every 10000 milliseconds(10sec)
        </script>
   </head>
    <body>
    <div id="load_me"> <%@ include file="showdata.jsp" %></div>
    </body>
</html>
 
Question

Hi !

I try this code but on the first load of the page, we see this:

<%@ include file="gps.htm" %>

And id don't show me the map, after 120 seconds (this time i give) the map is there, but why the first load it's show me the code ?

Thanks

Here's a tutorial we've used in the past from: http://wowjava.wordpress.com/2010/0...-content-without-reloading-page-using-jquery/


Code:
<html>
	<head>
		<Title>Just A Test</Title>
		<script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript">
        var auto_refresh = setInterval(
        function ()
        {
        $('#load_me').load('showdata.jsp').fadeIn("slow");
        }, 10000); // autorefresh the content of the div after
                   //every 10000 milliseconds(10sec)
        </script>
   </head>
    <body>
    <div id="load_me"> <%@ include file="showdata.jsp" %></div>
    </body>
</html>
 
Thanks all for your help ! Finally the right solution is the answer from "hq320" this code work and make everything i want.

Thanks
 
Status
Not open for further replies.
Back
Top