Sebastian Müller
Sebastian Müller

Reputation: 5589

render div container with ajax in ruby on rails application

In my application I call the controller foo that sets a variable var to a value and then want to render the the div container with id bar_var. Therefore I have a js.erb file with the code

$('#bar_var').html("<%= escape_javascript(render :partial => ....)

How can I pass the variable parameter var to differ between container bar_1 and bar_2 perhaps? The bar parameter is passed via get parameters and also via ruby class variables.

Upvotes: 0

Views: 459

Answers (1)

fl00r
fl00r

Reputation: 83680

As far as your question is kind of unclear I will suggest this

$('#bar_<%= params[:var] %>').html("<%= escape_javascript(render :partial => ....)

Upvotes: 1

Related Questions