I'm creating a basic forum where every message contains the authors name, some text and the date it was created. I'd like the forum to update constantly through AJAX, and show new posts that were created on the fly.
I currently have a PHP file getlatest.php?lastid=...
that retrieves all posts from the ID given to the most current.
It returns the data in HTML, like so (i've altered it so you can see the divs, stackoverflow throws them out):
foreach ($print as $value) { $readyText .= div id = $value->post_id; $readyText .= $value->first_name.' '.$value->last_name.' posted the following:'. $value->post_text.' The post was made about '.$time.' ago. $readyText .= '/div>'; }
Ben her birkaç dakikanızı alır jquery bazı AJAX kodu var
setInterval("update()", 3000);
function update()
{
$.get("getlatest.php",
{
id: latestmessage
},
function(response){
$("#forum_entries").prepend(response);
latestmessage = $.cookie('last_post_id'); //This is
//how I know what the latest post id is
}, "html");
Ben şöyle (şimdi çok popüler) sarı solmaya tekniği kullanılarak sunuldu tüm yeni mesajları vurgulamak istedim
$("#somediv").effect("highlight", {}, 1500);
My question is - to what div to I apply this effect? I should add that back in PHP, every forum post had a div id that was actually its PK in the database.