0
我嘗試ajax裏面的產量,所有工作正常,但是當我實現ajax替換html在application.html.erb(佈局)ajax不工作,並且不能替換html。如何用rails中的ajax替換application.html.erb中的html?
我application.html.erb:
<li id="header_notification_bar" class="dropdown">
<a id="click_notif" data-toggle="dropdown" class="dropdown-toggle" data-remote="true" href="#">
<i class="fa fa-bell-o"></i>
<span id="notif_count" class="badge bg-warning"></span>
</a>
<ul id="notif_content" class="dropdown-menu extended notification">
</ul>
</li>
<script>
$(document).ready(function() {
$('#notif_content').html("<%=j render 'layouts/load_notif' %>");
$("#click_notif").click(function(){
$('#notif_count').html("<%=j render 'layouts/notif_count' %>");
});
});
</script>
如果內部收益率的AJAX工具,在控制器的動作應該添加format.js
和我創建action_name.js.erb
文件,但如果在application.html.erb是我應該做的???