Hello Chris, Not working means page is not getting refreshed after 5 seconds.
I have content which changes after some time (lets say i want to show latest tweets using some hash tag) so this file(test.php) has to get refreshed after 5 second so i can get/show new tweets. I am not getting any error/message with ryan code. I think over there time is only getting. i cant see(in address bar) that my page is getting refreshed. Suppose i am on my index page and i have a div which is having this file(test.php) so i want to refresh that file after 5 seconds automatically. How can i get that? On Feb 9, 2:48 pm, cbolson <[email protected]> wrote: > > Its not working. > > What do you mean by that? > In what way is it not working? (eg it never loads anything, it doesn't > refresh etc.) > > I have just done a quick test with Ryans test (not on mooshell so as > to be able to check that the url is loaded correctly) and it works > "out of the box" - ie Ryan's example code is fine. > Here is my test:http://www.cbolson.com/sandbox/mootools/contents-url-reload/ > > If it is not working for you, there is possibly some other element on > the page that is preventing it from working. > Chris > > On 9 feb, 08:35, Deepali <[email protected]> wrote: > > > Ryan, > > > Its not working. > > > window.addEvent("domready", function(){ > > var content = $("content"), url = "test.php"; > > content.load(url); > > (function(){ > > content.load(url + "?t=" + $time()); > > }).periodical(1000); > > > }); > > > what we are missing here? > > On Feb 9, 12:21 pm, Ryan Rampersad <[email protected]> wrote: > > > > Sorry, I read your original question too fast. > > > > In Request.HTML has an element shortcut that is the same as > > > $(id).load(url). > > > > You can do something like this > > > > window.addEvent("domready", function() { > > > var content = $("content"), url = "test.php"; > > > content.load(url); > > > (function(){ > > > content.load(url + "?t=" + $time()); > > > }).periodical(8000); > > > > }); > > > On Tue, Feb 9, 2010 at 1:15 AM, Deepali <[email protected]> wrote: > > > > Thanks for your reply Ryan. > > > > > Actually i dont wanted to use mata tag. I have page where i am using > > > > two different plugin which works with mootools. i have got the script > > > > where page refreshes automatically but it works with jquery. > > > > here is that code. > > > > > <script> > > > > $(document).ready(function() { > > > > $("#responsecontainer").load("test.php"); > > > > > var refreshId = setInterval(function() { > > > > $("#responsecontainer").load('test.php?randval='+ > > > > Math.random()); > > > > }, 8000); > > > > }); > > > > </script> > > > > </head> > > > > <body> > > > > > <div id="responsecontainer"> > > > > </div> > > > > > But i can not use this code. its creating conflict with the mootool > > > > file. so can you please tell me how can i make the page refresh with > > > > mootools? > > > > > I tried your code but its not working and i am not getting any error > > > > also. > > > > > p > > > > > On Feb 9, 12:06 pm, Ryan Rampersad <[email protected]> wrote: > > > > > You probably don't want to use periodical since you'll be reloading > > > > > the > > > > page > > > > > anyway. > > > > > > Perhaps you want to use delay instead. > > > > > > window.addEvent("domready", function() { > > > > > (function(){ > > > > > window.location.href = window.location.href; > > > > > }).delay(5000); > > > > > > }); > > > > > > But if you're just refreshing the page, you may want to use a meta > > > > > tag or > > > > a > > > > > header anyway. > > > > > > On Tue, Feb 9, 2010 at 12:23 AM, Deepali <[email protected]> wrote: > > > > > > Hello, > > > > > > I want to refresh my test.php page after each and every 5 seconds. I > > > > > > was playing around with periodical function but it seems i am not > > > > > > writing it properly. > > > > > > > here is my code- > > > > > > > <script type="text/javascript"> > > > > > > window.addEvent('domready', function(){ > > > > > > $('content').load('test.php'). > > > > > > periodical(5000); > > > > > > > }); > > > > > > </script> > > > > > > </head> > > > > > > <body> > > > > > > <div id="content"> > > > > > > Loading content...</div> > > > > > > > Can anyone please tell me how can i refresh(auto) my page with > > > > > > mootools? > > > > > > > Thanks in advance. > > > > > > -- > > > > > Ryan Rampersadwww.ifupdown.com > > > > -- > > > Ryan Rampersadwww.ifupdown.com
