473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Adding different data to different jquery tabs

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().

Expand|Select|Wrap|Line Numbers
  1. function updateMessage()
  2. {   
  3.     $.ajax({
  4.     url:"db.php",
  5.     type:"post",
  6.     dataType:"text/xml",
  7.     success:function(data)
  8.     {
  9.         $(data).find("message").each(function() {
  10.             var msg_id = $(this).find("msg_id").text();
  11.             var date_time = $(this).find("date_time").text();
  12.             var from_user = $(this).find("from_user").text();
  13.             var from_group = $(this).find("from_group").text();
  14.             var to_user = $(this).find("to_user").text();
  15.             var to_group = $(this).find("to_group").text();
  16.             var msg_type = $(this).find("msg_type").text();
  17.             var msg = $(this).find("msg").text();
  18.             var grp_abr = $(this).find("grp_abr").text();
  19.  
  20.             var html = "<tr class='blue'>";
  21.             html += "<td><a href='#' class='bullet' onclick='changeStatus(\""+msg_id+"\")'><\/a><\/td>";
  22.             html += "<td><a href='#' class='reply' onclick='reply(\""+from_user+"\");'><\/a><\/td>";
  23.             html += "<td>"+date_time+"<\/td>";
  24.             html += "<td>"+from_user+"["+from_group+"]"+"<\/td>";
  25.             html += "<td>"+to_user+"["+to_group+"]"+"<\/td>";
  26.             html += "<td><a href='#' class="+msg_type+"><\/a><\/td>";
  27.             html += "<td><a href='#' class='flag_msg' onclick='flagMsg("+msg_id+")'><\/a><\/td>";
  28.             html += "<td>"+msg_id+msg+"<\/td>";
  29.             html += "<td>"+grp_abr+"<\/td><\/tr>";
  30.             });
  31.         }
  32.   });
  33.   setTimeout('updateMessage()',3000);
  34. }
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.
Dec 17 '09 #1
1 2929
kovik
1,044 Expert 1GB
I'm not a jQuery user, so I can't provide any concrete code for you.

However, can't you just have Array objects that contain all of the information for each tab that is received from the AJAX requests and, upon receiving new data, call functions to update the display of the tabs based on the information from the Array objects?
Dec 17 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: smith4894 | last post by:
Hello, I have a question regarding storage locations for different data types. For example, dynamically created objects (using "new") are created on the heap. local objects ( foo() {int x;} )...
4
by: troloo | last post by:
Hello, I hope you can help me :)) The story goes as follows: I have a class with different methods and member variables. I store pointers to objects of this class inside a vector. Now, I would like...
1
by: John Smith | last post by:
How do I use two different data types with a conditional operator ? I want to cout either a character or an integer depending on a certain condition. cout << ((IsThisTrue? char:integer) The...
5
by: Nico | last post by:
My database have 20 tables and many users. I wish to store encrypted data in 3 tables and have only 3 users have access to them, walking into tables or using forms. Can someone point me a direct...
2
by: Schnogge | last post by:
Hi! it is possible to generate an multiple-dimensional array with different data types? Or is it possible to combine a one-dimensional array with an other which has an other data type? How...
7
by: Ravi | last post by:
Hi, I need to accomplishe few things in XML, a. For a value of attribute , I have to define and assign different data types depends upon my condition. Is it possible. b.Is it possible to send...
4
by: WuJianWei | last post by:
Is there a way(function) to distingusih between different data types? if u can, provide me with the code... thank u...
3
by: Emma Middlebrook | last post by:
Hi there, I've been trying to implement a repeater control in an ASP.NET 2 page but I can't seem to get the layout exactly how I want and I'm not sure if it's something that I am doing wrong or...
5
by: Lucvdv | last post by:
This would better be described by 'serialization' than 'interop', but I didn't find a newsgroup that seems closer on topic. The problem in a few words: I save data with DataSet.WriteXML, but I...
0
by: burledivya | last post by:
Hi Every one, Iam Divya working as developer. I had some issues. In my 2 years this is the first forum i saw which is very active in posting the answers. I hope you could solve this also. Here...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.