数秒ごとに[Foundation]タブに含まれる部分をリロードしようとしています。Rails - javascriptの間隔で部分をリロードする
アプリケーション/ビュー/ xrf_cocs/show.html.erb - 私はレールを移入しています場所です - 私が最初に部分的
<div class="tabs-panel" id="panel6v" style="border-left: solid 1px #f2f2f2">
<%= render 'lead_reports/index' %>
</div>
アプリケーション/コントローラ/ xrf_cocs_controller.rbをレンダリングてるところです部分
def show
@positive_lead_reports = LeadReport.all.to_a
@positive_lead_reports.delete_if{|cur| cur.xrf_coc_id != @xrf_coc.id}
@negative_lead_reports = LeadReportNeg.all.to_a
@negative_lead_reports.delete_if{|cur| cur.xrf_coc_id != @xrf_coc.id}
end
アプリ/ビュー/ lead_reports/_index.html.erbためのオブジェクト - これは、部分的
<div id="lead_reports">
<% @positive_lead_reports.each do |lead_report| %>
<table>
<thead>
</thead>
<tbody>
</tbody>
</table>
<% end %>
... repeat above for negative reports
</div>
内部コードの要旨であります
基本的には私のapps/views/xrf_cocs/show.html.erb
ファイル内にjQuery関数を追加しようとしていますが、それはrender 'lead_reports/index'
を3秒ごとに呼び出します。
誰でも誰かに助けてもらえますか?
AJAXはフォーム送信がある場合にのみ機能します。これは何も送信していない、そこに私はあまりにも応答することができますアヤックスのリクエストが送信されます。 –
AJAXはフォーム送信とは関係ありません。これは単にデータを転送する方法です。 setIntervalを使用して、単にajaxリクエストをトリガーすることができます。上記のリンクを確認してください。 –