gem 'pjax_rails'
//= require jquery.pjax
// app/assets/javascripts/application.js
$(function() {
$(document).pjax('a:not([data-remote]):not([data-behavior]):not([data-skip-pjax])', '[data-pjax-container]')
})
<body>
我是一隻小小小小鳥 <%= Time.now %>
<div data-pjax-container>
<%= yield %>
</div>
</body
<div data-pjax-container>
<!-- PJAX updates will go here -->
<%= content_tag :h3, 'My site' %> <br>
<%= link_to 'test_pjax_person_1', '/people/1' %>
<!-- The following link will not be pjax'd -->
<%= link_to 'test_skip_pjax_person_1', '/people/2', 'data-skip-pjax' => true %> <br>
</div>
使用pjax後的請求
未使用pjax的請求
項目下載 liutaiquan