Search code examples
javascriptruby-on-railsescapingrails-cells

escape_javascript not working in rails 3.2.7


In application.js:

$(document).ready(function() {
    var After = 5000;
    var refreshId = setInterval(function() {
        $("#test").html("<%= escape_javascript(render_cell :test, :display) %>");
    }, After);
});

This is supposed to render the cell...But what it gives me in the browser is this: <%= escape_javascript(render_cell :test, :display) %>

Rails did not interpret the ruby part...It just gives it back as plain text...

What could be wrong?


Solution

  • did you mean application.js.erb?

    JavaScript doesn't know ruby.