0

I make an ajax call to edit a form by doing this:

$(".edit_meeting_button").live("click", function(){
  var mid = $(this).attr("id");
  $.ajax({type:'GET', url: '/meetings/' + mid + '/edit', success: function(data) {
    $(".right-box").html(data);
  }});
  $(".display_zone").html("<%= escape_javascript(render :partial => "display_attendees", :locals => {:all => @atendees}) %>");
  return false;
})

I get the desired action where the div ".right-box" displays the form to edit but the next call to update the ".display_zone" fails to update with a new set of @attendees which I processed in the controller when I called the edit form. So I want ".display_zone" to show me the new attendees but it does not. I guess this would work but I wanted to ask if there was a more slick (and correct) way of achieving this.

$(".edit_meeting_button").live("click", function(){
  var mid = $(this).attr("id");
  $.ajax({type:'GET', url: '/meetings/' + mid + '/edit', success: function(data) {
    $(".right-box").html(data);
  }});

  $.ajax({type:'GET', url: '/meetings/update_display' + mid, success: function(data) {
    $(".display_zone").html(data);
  }});

  return false;
})

Thanks!

absolutskyy
  • 567
  • 10
  • 20

1 Answers1

0

According to this question Rendering a partial in assets I don't think you can use "render" inside assets, but as a workaround for your solution I think it would be better if you return both partials you want to use in the same ajax call instead of using 2 calls.

I hope that helps

Community
  • 1
  • 1
Amir Kolta
  • 231
  • 2
  • 8