John
John

Reputation: 6612

Update page without trigger or event

I'm implementing a twitter like news system on my website. It loads all news items on page load with an ajax call fine. But how do I show a new item without having a trigger like a page load or a click on something? So when a new item is added to the database, It should automatically be added to an open page, like an auto-update or something.

Upvotes: 1

Views: 334

Answers (2)

Rafay
Rafay

Reputation: 31033

you can look into

ajax polling

reverse ajax

comet

server polling

here is a useful link http://www.zeitoun.net/articles/comet_and_php/start

edit

you can achieve the effect by using jquery alone below are some useful links

http://jquery-howto.blogspot.com/2009/04/ajax-update-content-every-x-seconds.html

Timeout jQuery effects

Upvotes: 2

Bjoern
Bjoern

Reputation: 16304

If you don't have an event, you have to generate one. A common practise to archive this is to have a timer running on the client/browser which fires an event in certain intervals to generate ajax requests.

Here are a few jquery plugins which might help you: http://plugins.jquery.com/project/timers

Some SO posts which are in a similar direction:

Upvotes: 0

Related Questions