Hi all, here is my latest code, still doesnt work with ie, but it is
cleaner and neater now, before i continue, i would like to thanks
those who have try to help me..

A variable call "last" is use to track the latest post id, so that i
could use it to query the database and retrieve messages after the
last retrieve one.

Ajax caller
function getmessage()
                var pars = 'last=' + last;

                var myAjaxget = new Ajax.Request('json.php',
                                method: 'get',
                                parameters: pars,
                                onComplete: loadcomplete
                window.setTimeout("getmessage()", 2000);

function loadcomplete(request) {
  var arrlast = [];
  var elDisplay = $('display');

  if (!elDisplay) return;

  var postTemplate =  new Template(
    '<tr><td><span class="post" id="#{id}">'+
    '</span><span class="date">#{date}</span>'+
    '<p><span class="username">#{name}:'+
    ' </span>#{content}</p><hr/></td></tr>'
  //var response = request.responseJSON.evalJSON();
  var response = request.responseJSON;
 if (!response || (response && !response.message)) return;

  $A(response.message).each(function(m) {
      top: postTemplate.evaluate(m)
  last = arrlast.max();

response from Json.php
29  Sep, 03:51 PM"}]}

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 

Reply via email to