tags:

views:

78

answers:

1

I have a .txt file that I need to include into a page, that gets dynamically updated every 5 seconds, so I need to refresh it via ajax, so that the updated content can be seen without refreshing the page. I want to do it so it fades into the div, with every 5 second update.

Currently Im doing it like this, which is pretty ugly looking

function getSearches() {
      $("#latest_searches").animate({ 
        opacity: 0.3
      }, 1000 );

$("#latest_searches").load("_latest_searches.php", '', callback);
}

function callback() {
  $("#latest_searches").animate({ 
        opacity: 1
      }, 1000 );

setTimeout("getSearches();", 5000);
}

$(document).ready(getSearches);
+2  A: 

I think you want to create a Digg Spy-like effect, check this demo.

Check also this article/screencast: Simple jQuery Spy Effect

CMS
Nice link - might have to incorporate that on SO somewhere!
Jarrod Dixon