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

后端 未结 2 582
故里飘歌
故里飘歌 2021-01-31 06:25

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         


        
2条回答
  •  迷失自我
    2021-01-31 06:56

    You could create this file : /app/views/org_pages/index.js.erb and put this in your file :

    jQuery("#image_center").html("<%= escape_javascript(render(:partial => 'pages/top_link')) %>");
    

    This code will be rendered and executed on success.

提交回复
热议问题