查看:
<%= link_to "Link", {:action => "AjaxView",:col => "colname"}, :update => "Ajaxcall", :remote => true %>
控制器:
def AjaxView
@vars= Var.find(:all,:conditions => { :varName=> "one" },:select=>(params[:col]))
respond_to do |format|
format.js { render :layout=>false }
end
end
AjaxView.js
$("#3").text("<%= escape_javascript(render(:partial => "var", :collection => @vars)) %>");
_var.html.erb
<%= var.col1 %>
我收到以下错误: ActionView :: Template :: Error(缺少属性:col1): 1:&lt;%= var.col1%&gt;
答案 0 :(得分:1)
<%= @var[0].col %> is the right answer