473,387 Members | 1,569 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,387 software developers and data experts.

Adding rows to a table by javascript

6
Hi

I want to Query a database using AJAx and display the results in the middle rows of an existing table. right now the server builds rows and return them to the main page, but I don't know how to insert them to the right spot.
basically, I look for a function he inserts a string before /after some row in the table .

in the pad I have:
<table>
<tr><td>Header</td></tr>
<tr><td>footer</td></tr></table

I have a string : "<tr><td>Result 1</td></tr>" I want to insert between the Header and the footer using Javascript. How can I do it? [I get this string from the server].

Thanks
Yuval
Mar 25 '08 #1
4 1608
hsriat
1,654 Expert 1GB
This example may help you.
Mar 25 '08 #2
yuvaly
6
Thank you, but this example uses Insert Row, that means I have to read the content of the response I get from the server to know whar rows/collums to insert, when in the server they already formatted it so I can just insert it...I want to insert a whole string [that represents several rows] into the table between the two rows.
Mar 26 '08 #3
hsriat
1,654 Expert 1GB
Thank you, but this example uses Insert Row, that means I have to read the content of the response I get from the server to know whar rows/collums to insert, when in the server they already formatted it so I can just insert it...I want to insert a whole string [that represents several rows] into the table between the two rows.
That is not possible I guess. Instead sending the whole string from the server, send tokenized string (with all the fields and rows saperated by token eg. a pipe |). And on the front, split() it and add the rows at required positions.
Mar 26 '08 #4
iam_clint
1,208 Expert 1GB
you can do table.innerHTML = table.innerHTML+MyOtherVar;

However this is not standard and may not work on some browsers properly.
Mar 26 '08 #5

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

Similar topics

7
by: jon | last post by:
I'm trying to add a row to a table and I think I'm not doing something right. The sample code below contains a table with 4 single cell rows, a button and a javascript function that the button...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
0
by: Sileesh | last post by:
Hi I have html table and a Button in an Aspx page. I am adding one row with some textboxes to Html table each time i click on the Button thru Javascript. Now problem is when when i try to...
2
by: Muzzy | last post by:
Hi, I've used information on these newsgroups to build many pages. So I thought that now that I have my script working (something that I've been working on for about a week), I should post it so...
2
by: Amy | last post by:
Is it possible to do so?
18
by: sandeepdesai | last post by:
Hi.. i am new to javascripts, i am using a addRow scipt to add rows to a table dynamically. one of the cells(say cell2) in a Nth row needs to be hyperlinked to another script. for example: ...
4
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is...
3
by: didi86 | last post by:
Please help me to adding multiple row at a time... // Last updated 2006-02-21 <script language="javascript"> function addRowToTable() { var tbl = document.getElementById('tblSample'); ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.