0

リンクをクリックしたときに div の内容を変更しようとしています。パーシャルとjsがレンダリングされていることをコンソールから確認できますが、htmlが更新されません

index.html で:

<div id="test">this is supposed to change</div>
 ...

<%= link_to 'planner', test_path(:budget => "b2", :size => "g2", :age => "a1", :activity => "l2", :tourist => "t2", :city => "boston"), :method => :get, :remote => true, :id => "linkto" %>

私のplanner_controllerで:

    respond_to do |format|
    format.html
    format.js {render :layout => false}

update.js.erb で:

$("#test").update(" <%= escape_javascript(render('load')) %>")

_load.html ファイル:

<p> test </p>

エラーは、コードをテストしているだけで、クエリの結果に対して実際には何もしていない可能性がありますか?

4

3 に答える 3

0
$("#test").update(" <%= escape_javascript(render :parial => "load") %>")

これを試して

于 2013-01-28T07:01:51.220 に答える
0

update() の代わりに replaceWith() を使用できます

$("#test").replaceWith(" <%= escape_javascript(render('load')) %>")
于 2013-01-28T10:29:04.410 に答える
0

ID の要素を更新してtestいますが、ページのどこにもその要素がありません。

于 2013-01-28T06:16:20.233 に答える