This line works fine
<%=link_to_function "name", "$('#thing_name').html('<p>name<p>')" %>
This line doesn’t
<%=link_to_function "name", "$('#thing_name').html('<%= escape_javascript(thing.name) %>')" %>
Then I get rid of all the content within <%= %>
<%=link_to_function "name", "$('#thing_name').html('<%= %>')" %>
It still keeps complaining about some weird compile errors.
Thanks in advance.
You are already inside an ERB block due to the opening
<%=at the very beginning, and you cannot use another one. Use string interpolation to evaluate Ruby code inside the string:Alternatively, if for some reason you don’t want to use interpolation: