在我的index.html.erb
页面中,当从 MSSQL 查询数据时,它会显示为
Me&Mine
. 我试过这个:
$("#3").text("<%= escape_javascript(raw render(:partial => "var") %>");
但它不起作用。
index.html.erb :
<%= link_to "Link", {:action => "AjaxView",:col => "colname"},
:update => "Ajaxcall", :remote => true %>
<tr>
<td id="#3" style="height:25px">data displayed here</td>
控制器:
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.erb:
if ( @col.to_s == "colName") {
$("#3").text("<%= escape_javascript(render(:partial => "var") %>");
}
elsif ( @col.to_s == "colName1")
{
$("#2").text("<%= escape_javascript(render(:partial => "var") %>");
}
_var.html.erb:
<%= var.col1 %>
我怎样才能显示Me&Mine
而不是Me&Mine
?