Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> A Periodical Loader With Jquery

This is a discussion on A Periodical Loader With Jquery, within the Javascript section. This forum and the thread "A Periodical Loader With Jquery" are both part of the Frameworks category.

 
Reply to this topicStart new topic
> A Periodical Loader With Jquery, load a mini php function every x seconds
cosmicbdog
post Jul 4 2008, 11:07 PM
Post #1


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


I use prototype's periodicalUpdate() function to display a fairly close to realtime status of users in our backend.

Theirs basically looks like this =>
CODE
new Ajax.PeriodicalUpdater('updateme', 'status.php',
  {
    method: 'get',
    frequency: 5
  });


+ the 120kb prototype library you're not allowed to touch really.


So my question is, how does one go about this with jQuery?

I did come across a plugin http://jquery.com/plugins/project/spy but it seems to do more than what I'm wanting which is just to simply refresh a div with a php file every few seconds.

Any ideas?
Go to the top of the page
 
+Quote Post
Rakuli
post Jul 4 2008, 11:20 PM
Post #2


Squeeze Machine
Group Icon

Posts: 766
Joined: 13-February 08
From: Catching the squeezed drips downunder.


I don't think jQuery has a special periodical updater but the function is not hard to achieve

CODE
function callMeOften()
{
     $.ajax({
                   method: 'get',
                   url : 'status.php',
                   dataType : 'text',
                   success: function (text) { $('#updateMe').html(text); }
                });

}

var holdTheInterval = setInterval(callMeOften, 5000);


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
cosmicbdog
post Jul 5 2008, 01:09 AM
Post #3


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


QUOTE (Rakuli @ Jul 5 2008, 02:20 PM) *
CODE
function callMeOften()
{
      $.ajax({
                    method: 'get',
                    url : 'status.php',
                    dataType : 'text',
                    success: function (text) { $('#updateMe').html(text); }
                 });

}

var holdTheInterval = setInterval(callMeOften, 5000);



That works a treat. bye bye prototype.
Go to the top of the page
 
+Quote Post
Monie
post Sep 2 2008, 11:11 PM
Post #4


Squeeze Machine
*****

Posts: 733
Joined: 13-February 08
From: Borneo


Is this the method that is being used in some chatting site?
Or like the one we use to have in WF chatbox biggrin.gif

I am just wondering what is the best way to achieve this.
Cheers...


--------------------

Go to the top of the page
 
+Quote Post
Rakuli
post Sep 2 2008, 11:16 PM
Post #5


Squeeze Machine
Group Icon

Posts: 766
Joined: 13-February 08
From: Catching the squeezed drips downunder.


Yeah, something similar. Basically an ajax request that is set on an interval to check every X amount of time.


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
Monie
post Sep 3 2008, 01:40 AM
Post #6


Squeeze Machine
*****

Posts: 733
Joined: 13-February 08
From: Borneo


Ahh..! I'll quote you for that biggrin.gif
Thanks for the priceless tips from both of you!


--------------------

Go to the top of the page
 
+Quote Post
Antti
post Sep 3 2008, 02:04 AM
Post #7


Rapid Squeezer
Group Icon

Posts: 308
Joined: 15-February 08
From: Finland


This is definately very good to know. I already can think a lot of things to use this for. Thanks!


--------------------
Go to the top of the page
 
+Quote Post
Monie
post Sep 3 2008, 05:05 AM
Post #8


Squeeze Machine
*****

Posts: 733
Joined: 13-February 08
From: Borneo


Me too...
For now what I can think of is some simple chatting box, who's online page, ermm... what else biggrin.gif
What else do you have in mind Antti? Please share with me, would you?


--------------------

Go to the top of the page
 
+Quote Post
cosmicbdog
post Nov 12 2008, 12:05 PM
Post #9


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


it could be used to also display updates of:

=> what is new content (if your site is updated that regularly)

it works well on facebook. which is essentially just a chatting box (with more characters) so i'm not adding anything new here. but it can be applied to more than just personal messages and extend to new pictures uploaded, new blogs, new forum posts. i imagine that will be standard stock forum moderating tools in the near future. as mods browse the site they get little examples should they choose of new posts that have been added and have the ability to take immediate action should it break guidelines etc or maybe it has an urgency to it.

just ideas smile.gif i might try some of them
Go to the top of the page
 
+Quote Post
japh
post Nov 12 2008, 05:00 PM
Post #10


Squeeze Machine
Group Icon

Posts: 508
Joined: 7-October 08
From: Australia


I used jQuery's Timer plugin for the example in your other thread for Counting Users Online.


--------------------
The more you visit, the more I'll post: http://japheththomson.com/
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   2 Jason 382 6th May 2008 - 07:33 AM
Last post by: Rakuli
No New Posts   8 unitedcraig 575 9th September 2008 - 10:03 PM
Last post by: Monie
No New Posts   10 MikeHopley 1,273 21st June 2008 - 07:40 PM
Last post by: karinne
No new   19 jackfranklin 609 21st June 2008 - 07:39 PM
Last post by: karinne
No New Posts   3 Monie 319 29th June 2008 - 05:46 PM
Last post by: sylvatica