简体   繁体   中英

Cannot render a Partial view from JavaScript in ruby on rails

On get response i want to render a partial view using javascript.this is my coffeescript file. scrolls.coffee

$.getJSON('/scrolls/output.json',{name: value}).done (data,status,e) ->
    $("#show_output").append("<% escape_javascript( render partial: 'scrolls/output') %>")

Instead it is just showing plain text inside the append that is this is the output.

<% escape_javascript( render partial: 'scrolls/output') %> 

Why my ruby code is not executing in coffeescript.I used coffee.erb .extention too.Same output.My rails version 4.2.4

尝试使用“#{escape_javascript(render局部:'scrolls / output')}”,而不是<%%>。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM