Adding different data to different jquery tabs

Posted by Sarah on Stack Overflow See other posts from Stack Overflow or by Sarah
Published on 2009-12-17T09:54:04Z Indexed on 2010/04/16 9:03 UTC
Read the original article Hit count: 152

Filed under:
|

i have 2 functions
1- addMessage(): save data into database and is called only on click .
2-updateMessage():get data with ajax from database, called when document is ready ,called every 3 seconds for new data, and called on success of addMessage().

function updateMessage()
{   
    $.ajax({
    url:"db.php",
    type:"post",
    dataType:"text/xml",
    success:function(data)
    {
        $(data).find("message").each(function() {
    	    var msg_id = $(this).find("msg_id").text();
    	    var date_time = $(this).find("date_time").text();
    	    var from_user = $(this).find("from_user").text();
    	    var from_group = $(this).find("from_group").text();
    	    var to_user = $(this).find("to_user").text();
    	    var to_group = $(this).find("to_group").text();
    	    var msg_type = $(this).find("msg_type").text();
    	    var msg = $(this).find("msg").text();
    	    var grp_abr = $(this).find("grp_abr").text();

      	    var html = "<tr class='blue'>";
    	    html += "<td><a href='#' class='bullet' onclick='changeStatus(\""+msg_id+"\")'><\/a><\/td>";
    	    html += "<td><a href='#' class='reply' onclick='reply(\""+from_user+"\");'><\/a><\/td>";
     	    html += "<td>"+date_time+"<\/td>";
      	    html += "<td>"+from_user+"["+from_group+"]"+"<\/td>";
      	    html += "<td>"+to_user+"["+to_group+"]"+"<\/td>";
      	    html += "<td><a href='#' class="+msg_type+"><\/a><\/td>";
            html += "<td><a href='#' class='flag_msg' onclick='flagMsg("+msg_id+")'><\/a><\/td>";
            html += "<td>"+msg_id+msg+"<\/td>";
            html += "<td>"+grp_abr+"<\/td><\/tr>";
            });
        }
  });
  setTimeout('updateMessage()',3000);
}

Now the data retrieved i want to add to different tabs with different names and different containers, how would i do that. My question isn't a matter of code, it is more about logic or sequence of steps. Any help please.

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery