javascript - SyntaxError: Unexpected token true in html generated by ruby -


why getting error: syntaxerror: unexpected token true in line

$('#atp_13').append("<a data-remote="true" rel="nofollow" data-method="delete" href="/clots/test/unjoin"><i class='icon-check clot-unfollow-icon'></i></a>)"); 

i m generating using

$('#<%= "atp_#{@atp.id}" %>').append("<%= link_to unjoin_atp_path(@atp), :method => :delete, remote: true %><i class='icon-check clot-unfollow-icon'></i><% end %>)"); 

$("#atp_<%=@atp.id %>").append("<%= escape_javascript(link_to unjoin_atp_path(@atp), :method => :delete, remote: true %><i class='icon-check clot-unfollow-icon'></i><% end %>)"); 

escape_javascript used escape rails helper methods replaced in page.

you can move link_to tag partial file make clean, , can call partial name in js.erb file.

$("#atp_<%=@atp.id %>").append("<%= escape_javascript(render(:partial => 'partial_name') ) %>"); 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -