Why isn't this passing text to javascript/jquery.? @i[:error]
definitely has a string in it, I can print that on console.
js.erb file -
<% if @i[:error] != "" %>
<% puts "--> " + @i[:error] %>
#--> error
#Validation error(s):
#- Item Is not defined or blank. # that's the error string in @i[:error]
$(function() {
$("#error_message").attr("class", "message_error");
$('#error').text("<%= @i[:error]%>"); #Not working for @i[:error]
#$('#error').text("<%= "#{@i[:error]}"%>");#Not working for @i[:error]
#$('#error').text("Test"); #This is working
#$('#error').text("<%= "?????"%>"); #This is working
});
<% else %>
........#fine here
<% end %>