내 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
을 어떻게 표시합니까?
& &을 원하십니까? Javascript가 작동합니까? 또한 귀하의 질문을보십시오, &으로 질문에 앰퍼샌드를 벗어나고 & amp ;이 아니라 도피해야 할 수도 있습니다. –