How to do render partial on jQuery ajax success method with rails 3

Viewed 21921

I'm using rails 3.2.1 with jQuery for an ajax call.

My jQuery code is :

jQuery.ajax({
  url: "/org_pages",
  data: 'org_id='+ org_id,
  type: "POST",
  success: function(result){                        
    jQuery("#image_center").html("<%= escape_javascript(render(:partial => 'pages/top_link')) %>");
  },
  error: function(){
    alert('Error occured');
  }
});

My problem is on the web page the output is showing this :

<%= render :partial => 'pages/top_link', :collection=>@pages %>

How it should display my render partial page. :(

2 Answers
Related