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
"<tr id='table_instructors'><td><img alt='Ajax-loader' height='16' src='/images/ajax-loader.gif' width='16' /></td><td>table_instructors</
<td><a href=\"/en/admin/remote_lockers/4d7b27b8a326cb033d00000b/
reloading.js?table=table_instructors\" data-remote=\"true\">start</a></
</tr>"
-- but strange ... if I copy this string into the js file (rather than calling the snippet helper) then NO ERROR ...
$('#upload_tables').append("<tr id='table_instructors'><td><img alt='Ajax-loader' height='16' src='/images/ajax-loader.gif' width='16' /></td><td>table_instructors</td><td><a href=\"/en/admin/ remote_lockers/4d7b27b8a326cb033d00000b/reloading.js? table=table_instructors\" data-remote=\"true\">start</a></td></tr>");
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 << "<a href='#'>Start</a>" ) then $('#upload_tables').append("<%= current_snippet(@remote_locker, @current) -%>"); doesn"t raise ANY ERROR
"<tr id='table_instructors'><td><img alt='Ajax-loader' height='16' src='/images/ajax-loader.gif' width='16' /></td><td>table_instructors</
<td><a href='#'>Start</a></td></tr>"
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