I have a rails application with some javascript. When the user clicks on a div, it triggers a bunch of things and should display / append a new object.
The simplified code is the following :
$(this).append("<div><%= escape_javascript(render(Question.find(15))) %></div>");
The problem is that I can't find anyway to randomly or smartly update the ID of the object called (here 15 for the example).
I can't call a javascript variable because it's inside "escape javascript" and I can't call a rails variable because it would work only once when the page loads, and then always display the same ID when the user triggers the action several times.
Any idea ?
data
options 3. You should use ajax call here – fl00r Oct 3 '11 at 13:46this
or newdiv
or someones else? – Bohdan Oct 3 '11 at 13:51