I don’t know if this question is titled appropriately.
I have a sidebar populated with clickable divs that represent objects in a database. When the user clicks one of these divs, I would like to fetch more detailed information via ajax and display the received information in a main content area.
Each sidebar div needs to have an associated id with it that I can pass to the server with my javascript.
I am wondering where I should put this id on the page?
Is there a best practices way of doing this?
I would store the data in
data-attributes.jQuery has a method
data()to easily retrieve / store data.For loading partial views from the server I would recommend
$.load().