Reputation: 13853
I have a cron job running searching Twitter every 5 minutes, each 5 minutes the results of the search are written to a database.
Im surfacing the twitter search results in a simple HTML list.
What I would like to do is load any new search results at the top of this list every 5 minutes.
Can any suggest how I might go about doing this?
Upvotes: 0
Views: 4509
Reputation: 10636
I would write a function to update the HTML list, then use setInterval
to run it:
function updateList(){ /*magic*/ }
setInterval(updateList,1000*5*60); //Run updateList every 5 minutes
Upvotes: 1
Reputation: 21531
Use the since_id
paramter - http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search
Upvotes: 0
Reputation: 9397
Why not simple use a window.setInterval() with a 5 minute interval to call the AJAX function every 5 minutes to get the new results?
Or you can also do it without any JavaScript. Just insert the HTML into an iframe and use the refresh meta in this iframe:
<meta http-equiv="refresh" content="3000; URL=http://www.example.com/twitterlist">
Upvotes: 0
Reputation: 2460
You should look at the jQuery Timers Plugin
Here's a tutorial with demo page to get you started
Upvotes: 2