[英]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. 得到响应后,我想使用javascript.this渲染局部视图。这是我的coffeescript文件。 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
为什么我的ruby代码没有在coffeescript中执行。我也使用coffee.erb
.extension。相同的输出。我的Rails版本4.2.4
尝试使用“#{escape_javascript(render局部:'scrolls / output')}”,而不是<%%>。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.