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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -