# AJAX to a table row

**URL:** <https://www.ruby-forum.com/t/ajax-to-a-table-row/53635>\
**Category:** Rails\
**Created:** [February 12, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/ajax-to-a-table-row/53635 "2006-02-12T20:15:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [February 12, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/ajax-to-a-table-row/53635/1 "2006-02-12T20:15:44Z")

</div>

Hello-

I’d like to throw a little AJAX into a table to allow the user to edit a  
single row of data inline rather than moving to another page.

The row (which has N columns) would be swapped out for a row which has a  
single column (colspan=“N”) and the form inputs would be in that row.

My question is, is this legal HTML? I can’t find anything that says  
either way. Basically, I’m thinking the HTML would look like:

…

 blah blah

 blah blah
...

During the AJAX call, “item\_44” would get replaced with something like:

...Edit Blah...

Is this ok?

Jake

---

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [February 12, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/ajax-to-a-table-row/53635/2 "2006-02-12T20:56:01Z")

</div>

Hi Jake,

Just add the id to the … so

 Whatever Whatever

You should not use

's when you don’t need to. Always try to use a  
already existing tag before resorting to a div.

Eric

Jake J. wrote:

> …

–  
Eric G.  
[ericgoodwin.com](http://ericgoodwin.com)

---

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [February 12, 2006, 10:01pm UTC](https://www.ruby-forum.com/t/ajax-to-a-table-row/53635/3 "2006-02-12T22:01:19Z")

</div>

> Also, for the record, adding a div inside a tr directly is against XHTML  
> standard  
> ([http://learningforlife.fsu.edu/webmaster/references/xhtml/tags/table/tr.cfm](http://learningforlife.fsu.edu/webmaster/references/xhtml/tags/table/tr.cfm)).

Thanks. This is what I was after. Though, for this particular case,  
the ID’ed will work just fine.

Thanks!

Jake

---

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [February 12, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/ajax-to-a-table-row/53635/4 "2006-02-12T21:29:32Z")

</div>

Eric G. wrote:

> Hi Jake,
> 
> Just add the id to the … so
> 
> Whatever Whatever
> 
> You should not use
> 
> 's when you don’t need to. Always try to use a  
> already existing tag before resorting to a div.
> 
> Eric
> 
> Jake J. wrote:
> 
> > …
> 
> –  
> Eric G.  
> [ericgoodwin.com](http://ericgoodwin.com)

Also, for the record, adding a div inside a tr directly is against XHTML  
standard  
([http://learningforlife.fsu.edu/webmaster/references/xhtml/tags/table/tr.cfm](http://learningforlife.fsu.edu/webmaster/references/xhtml/tags/table/tr.cfm)).
