samedi 12 août 2017

How to convert a ruby array output into a string in JS?

I have this line coming from a helper in the BE and I want to set a variable with that output. No matter what I tried (toString, string interpolation etc) It keeps returning me the error:

Uncaught ReferenceError: a is not defined at eval (eval...

This is my code:

document.myStr = <%= get_str %>

This is the result:

document.myStr = a,b,c;

Aucun commentaire:

Enregistrer un commentaire