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