我正在努力实现以下目标:
$(".share-icon").html("<%= image_tag(@card.photo.url(:small)) %>");
这显然不起作用,但是如何在JS响应中使用
image_tag
?谢谢
最佳答案
尝试使用image_tag
转义escape_javascript
生成的html
$(".share-icon").html("<%= escape_javascript image_tag(@card.photo.url(:small)) %>");