View Single Post
11-28-2007, 12:30 AM
#1
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old  Prototype - Iteration

HTML Code:
<table border="1" style="display: none;" id="table">
	<tr>
		<th>Com</th>
		<th>Net</th>
		<th>Org</th>
		<th>Us</th>
		<th>Biz</th>
		<th>Info</th>
		<th>Co.uk</th>
		<th>Org.uk</th>
		<th>Tv</th>
		<th>In</th>
	</tr>
	<tr>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>
</table>
I have one table, two table rows. The first table row consists table headers and the second one WILL contain table data (currently they are blank).

I want to update the second table row, table data from an array.

It's an JSON array generated through Ajax query.

It is certainly not a good way to add id to each td and then update each table data with each line of code.

I'm thinking about iterating the query (like foreach query from PHP) via JSON array and updating the table data. First thing I need to do is to select the second table row from the table, then update the table data.

I'm not sure how to do it since I'm a beginner in javascript.

P.S: Using Prototype