为什么不pjax

时间:2012-04-28 12:28:38

标签: jquery pjax

欢迎,

今天我发现并决定放pjax,但我甚至无法从网站上复制文件都无效。

如何让它发挥作用? 全部填写here

顺便说一句,点击后可以更新几个块pjax吗?

提前致谢!

我的代码:

  <script src="http://pjax.heroku.com/jquery.js"></script>
  <script src="http://pjax.heroku.com/jquery.cookie.js"></script>
  <script src="http://pjax.heroku.com/pages.js"></script>

  <script src="http://pjax.heroku.com/jquery.pjax.js"></script>
  <script type="text/javascript">
    $(function(){
      // pjax
      $('ul a').pjax('#main')
    })
  </script>
<pre>

           / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
           | <b>It's 09:32:10 PM</b>
           \_  ________________
    .--.     (  )
   /    \   ( )
  ## a  a  .
  (   '._)
   |'-- |
 _.\___/_   ___<label><input type="checkbox" name="pjax" />pjax</label>___
   ."\> \Y/|<'.  '._.-'
  /  \ \_\/ /  '-' /
  | --'\_/|/ |   _/
  |___.-' |  |`'`
    |     |  |
    |    / './
   /__./` | |
      \   | |
       \  | |
       ;  | |
       /  | |
 jgs  |___\_.\_
      `-"--'---'

<a href="https://github.com/defunkt/jquery-pjax">github.com/defunkt/jquery-pjax</a>
</pre>

<div id="main">
  <ul>
  <li>home</li>
  <li><a href="/dinosaurs.html">dinosaurs</a></li>
  <li><a href="/aliens.html">aliens</a></li>
</ul>

<p>
  pjax loads html from your server into the current page
  without a full page load. It's ajax with real permalinks,
  page titles, and a working back button that fully degrades.
</p>

<p>
  Check the box to toggle pjax.
</p>

<p>
  Whenever the time changes, a full page load has happened.
  If the time doesn't change,  no full page load has occurred.
</p>

<p>
  The idea is you can't tell the difference between pjax
  page loads and normal page loads. On complicated sites,
  browsing just "feels faster."
</p>

<p>
  <a href="https://github.com/defunkt/jquery-pjax/tree/heroku">
    view this example's source code
  </a>
</p>

</div>

1 个答案:

答案 0 :(得分:1)

pjax演示页面依赖于服务器端处理。要使其使用静态页面,您需要使用fragment选项。