one problem with using javascript tags is the 'j' escape function in rails doesn't work correctly or doesn't work how you might expect it to work. the string you send it is not always preserved and is corrupted in subtle ways.
for example if you have a string like:
"<foo>"
and if you have:
<%= javascript_tag do %>
window.myvar = '<%= j "<foo>" %>';
alert(window.myvar);
<% end %>
then window.myvar == "<foo>"
the j function really has to replace '<' and '>' with '\u003C' and '\u003E'.
that should be:
then
one problem with using javascript tags is the 'j' escape function in rails doesn't work correctly or doesn't work how you might expect it to work. the string you send it is not always preserved and is corrupted in subtle ways.
for example if you have a string like:
and if you have:
then window.myvar == "<foo>"
the j function really has to replace '<' and '>' with '\u003C' and '\u003E'.