I do an Ajax call and get HTML (a table row, tr). Now I can stuff this into a table as well. But I'm doing some acrobatics for that. I stuff it into a invisible div first. Then get the row by element id. Then insert the row element else where.
Is there a cleaner way to convert text received from an Ajax call into a DOM element?
Because I already had an element(row) with the same id in the document. (It is a dynamically add row/remove row) kind of thing. So before adding it to the dom, I wanted to remove its id. The row id is the same because initially a jsp is included for a single row and later the same jsp is retrieved via ajax.
Anyway, I removed the initial rows id attribute in onLoad. So now I can do the inplace thing. Infact I might not need the id in the first place...but there are other things being loaded in the row too...gotta look into that.
But still, I'd like to know what's the best way to get a DOM element out of text?