how to add a dynamic value for a tag's id attribute

how to add a dynamic value for a tag's id attribute in the ajax call.For example:several "<td id="#{product.id}" colspan="4" align="center"></td>" and "<td><%=link_to_remote("MoreInfo",:update=>"#{product.id}",:url=>{:action=>"more_info",:id=>product},:method=>:get)-%></td>"in a page,i want every ajax result to replace its own "<td id="#{product.id}" colspan="4" align="center"></td>",instead of the same one.   so how to add a dynamic value for a tag's id attribute

Guo Yangguang wrote:

  how to add a dynamic value for a tag's id attribute in the ajax call.For example:several "<td id="#{product.id}" colspan="4"

Just a note that's an illegal ID. In summary, an HTML ID attribute must be unique to its page, and must satisfy naming conventions commonly ascribed to language variables, such as JavaScript variables. An ID may not contain punctuation or start with a number.

Always go id="product_<%= product.id %>", and also think about making the product_ prefix more context-specific.

align="center"></td>" and "<td><%=link_to_remote("MoreInfo",:update=>"#{product.id}",

>:url=>{:action=>"more_info",:id=>product},:method=>:get)-%></td>"in

:id => product.id

You might be passing the whole product by copy there. I'm not sure what it will turn into!

a page,i want every ajax result to replace its own "<td id="#{product.id}" colspan="4" align="center"></td>",instead of the same one.

Put the useful prefix on the id.

Next, think about handling the Ajax call with render :update do ... and put inside that an update_html directed at that id.

Thank you Phlip.But i also want to ask you how to make an ajax call to bring out an some size window when click a link.Just tell me the outline instead of detail about how to.Thank you!