I am doing an Ajax call, rendering ‘done.js.erb’ in which I wrote a
jQuery append built from an helper current_snippet
$(’#upload_tables’).append("<%= current_snippet(@remote_locker,
@current) -%>"); RAISES AN ERROR : missing ) after argument
list
— debugging the current_snippet helper, I get an html string as
output
“

td>
reloading.js?table=table_instructors" data-remote=“true”>start</
td>
– but strange … if I copy this string into the js file (rather than
calling the snippet helper) then NO ERROR …
$(’#upload_tables’).append(“
remote_lockers/4d7b27b8a326cb033d00000b/reloading.js?
table=table_instructors" data-remote=“true”>start
so the output string is well escaped … why plain string is working
well , but helper call is not …
I already used another snippet helper in a previous js line without
such problem…
$(’#<%= @previous -%>’).replaceWith("<%= previous_snippet(@previous) -
%>");
so it’s not the js line writing…
if I insert a simple link tag in the helper, rather than generating
it , ( html << “Start” ) then
$(’#upload_tables’).append("<%= current_snippet(@remote_locker,
@current) -%>"); doesn"t raise ANY ERROR
“

td>
it seems the ‘issue’ is in the link_to generated in the helper
link_to I18n.t(:start),
reloading_admin_remote_locker_path(remote_locker, :table =>
current, :format => :js), :remote => true
any clue ? thanks