Reputation: 6612
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
Reputation: 31033
you can look into
ajax polling
reverse ajax
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
Upvotes: 2
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