Source

pjax_flask / templates / pjax.html

Full commit
<!DOCTYPE HTML>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <title>PJAX and Flask</title>
  <style type="text/css">
  #main{
    padding: 10px;
    margin: 10px;
    width: 200px;
    border: 1px solid black;
  }
  </style>
  <script src="/static/js/jquery-1.6.2.min.js" type="text/javascript"></script>
  <script src="/static/js/jquery.pjax.js" type="text/javascript"></script>
  <script>
  $(document).ready(function() {
    console.log('load done');
    $('a.js-pjax').click(function(evt){
      evt.preventDefault();
      console.info(evt);
    });
    $("a.js-pjax").pjax("#main");
  });

  </script>
</head>
<body>

<div id="main">
  {% if p.main  %}
    {{ p.main }}
  {% endif %}
</div>

<h3>非同期バージョン</a><p/>
<a href="/parts/x" data-pjax="main" class='js-pjax'>パーツX</a><br>
<a href="/parts/y" data-pjax="main" class='js-pjax'>パーツY</a><br>
<hr>
<h3>同期バージョン</a><p/>
<a href="/parts/x">パーツX</a><br>
<a href="/parts/y">パーツY</a><br>
<hr>

</body>
</html>