How do I send a dynamic variable (album_id) too an ajax RJS file copied below?
This works fine with a static span ID but Im not sure how to transfer the album.id
How do I send a dynamic variable (album_id) too an ajax RJS file copied below?
This works fine with a static span ID but Im not sure how to transfer the album.id
.rjs files are Ruby, so lose the erb:
page.replace_html @albums.id, @albums.reload.votes_count
Also, in HTML, ID's are supposed to start with a letter (Basic HTML data types), so I would do something like this:
page.replace_html "albums_#{@albums.id}", @albums.reload.votes_count
(and a similar construct in the view)