Adding childs to list of parents with jquery /mvc2

Posted by John Landheer on Stack Overflow See other posts from Stack Overflow or by John Landheer
Published on 2010-05-11T09:56:12Z Indexed on 2010/05/11 10:24 UTC
Read the original article Hit count: 360

Hi,

I have a table of products on my page, each product has zero or more colors, the colors are shown as a list beneath the product. After the colors I have a button to add a color. The button will do an ajax call with the parent product id to a controller which will return a JSON object with color information. My problem is where to store the product id in the DOM, should I put it in a hidden field and use jquery in the click event of the "add color" to get to it? What is the best way to do this?

TIA,

John

EDIT: The page is initially rendered on the server so I don't want to use jquery to add the id's to the page.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about jQuery