ruby on rails - How can I use image_tag in a javascript response? -


i'm trying realize following:

$(".share-icon").html("<%= image_tag(@card.photo.url(:small)) %>"); 

this not working how can use image_tagin js response?

thanks

try escaping html generated image_tag using escape_javascript

$(".share-icon").html("<%= escape_javascript image_tag(@card.photo.url(:small)) %>"); 

Comments