title: JSON::GeneratorError in a .js.erb file
body: <p>I don't understand what I'm doing wrong..</p>
  
  <p>I am attempting to catch a 401 unauthorized and inserting a div with a message before the submit button using </p>
  
  <pre><code>$(function() {
    return $("a").ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
      if (jqXHR.status === 401) {
        $(".submit").before(&lt;%=j content_tag :div, "Does not compute" %&gt; );
      }
    });
  });
  </code></pre>
  
  <p>the name of the file is home.js.erb</p>
  
  <p>even before the page loads I get </p>
  
  <pre><code>JSON::GeneratorError in Pages#home
  
  Showing H:/project/app/views/layouts/application.html.erb where line #6 raised:
  
  only generation of JSON objects or arrays allowed
    (in H:/project/app/assets/javascripts/home.js.erb) 
  </code></pre>
  
  <p>line #6 refers to </p>
  
  <pre><code>5:   &lt;%= stylesheet_link_tag    "application.css", :media =&gt; "all" %&gt;
  6:   &lt;%= javascript_include_tag "application" %&gt;
  </code></pre>
  
  <p>obviously something is wrong.. but what?</p>