0
我有一個js.erb文件中的以下內容:不能用戶呈現js.erb文件
//add an image from the gallery to the mail later
$('.uploaded_image').click(function(){
var src=$(this).attr('src').replace("thumb", "medium");
var location = $('#user_image_location').attr('value');
$('#mailing_body').contents().find("[data-edit-img="+''+location+''+"]").attr('src', src);
$('#image_form').html('<%=render "user_images/form"%>');
$('[data-dismiss]="cancel"').click();
})
我以爲我可以使用ERB在js文件在頁面上更換內容。 我得到以下錯誤:
undefined method `render' for #<#<Class:0x00000103dea400>:0x000001059f2198>
如果我刪除以下行:
$('#image_form').html('<%=render "user_images/form"%>');
它所有的作品。
我認爲我可以在使用Rails js文件使用ERB 3.2
爲什麼這個不行?
在此先感謝。
謝謝馬克,清除了 – chell 2012-04-25 05:17:53