简体   繁体   English

如何使用Ajax调用更新部分,然后在Rails中渲染?

[英]How to update partial using Ajax call and then render in Rails?

I am not using erb, but using haml instead. 我没有使用erb,而是使用了haml。 So something like: 所以像这样:

$("<%= escape_javascript(render @user) %>").appendTo("#users"); 

in http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html is not working. http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html中的内容无效。

Does anyone have ideas? 有人有想法吗?

对于HAML ,请如下使用字符串插值

$("#{escape_javascript(render @user)}").appendTo("#users");  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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