mardi 6 décembre 2016

Partial is not being updated after ajax call in Rails

in my action.js.erb file

$("#performance").html("<%= escape_javascript(render 'performance_table',questions: @questions, groups: @groups, performances: @performances) %>")

in my view

<div class="col-xs-5">
  <div id="performance">
   <%= render 'performance_table', :questions => @questions, :groups => @groups, :performances => @performances  %> 
  </div>
 </div>

in my controller_action

@groups = classroom.groups
@questions = @quiz.questions
@performances = Array.new
i = 0
group_ids.each do |g|
  question_ids.each do |q|
    @performances.push(Answer.where("group_id = ? AND question_id = ?",g,q).first.userans)
  end
end

I am making an ajax call to an action and then I in the file of action.js.erb I am updating the html of my div by rendering the same partial but with updated values but partial is not rendering updated values. Kindly let me know what I am doing wrong . console is also showing no error at all

Aucun commentaire:

Enregistrer un commentaire