我不明白我在做什麼錯..JSON :: GeneratorError在.js.erb文件
我試圖搭上401未授權和提交按鈕之前的消息中插入一個div使用
$(function() {
return $("a").ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
if (jqXHR.status === 401) {
$(".submit").before(<%=j content_tag :div, "Does not compute" %>);
}
});
});
文件的名稱是home.js.erb
甚至在頁面加載我得到
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)
6號線是指
5: <%= stylesheet_link_tag "application.css", :media => "all" %>
6: <%= javascript_include_tag "application" %>
明明什麼是錯的..但什麼?