a minimal pjax implementation, optimized for understandability
JavaScript Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
public
views
.gitignore
Gemfile
Gemfile.lock
README.markdown
app.rb
config.ru

README.markdown

simpler pjax

Right now this code is too simple to be useful, except to show how the pjax technique works. For instance, it doesn't even check weather history.pushState is supported. For a more complete library, check out Chris Wanstrath's jquery-pjax library.

That said, if you're looking to understand how pjax works just take a look at public/pjaxify.js. At just 23 non-golfed lines of code, plus some comments, it's hopefully easier to follow. I think the pjax technique works best when you customize it to the needs of your site. Here I send a title and some markup down the wire in JSON, but you could easily imagine sending multiple blocks of markup (for different sections of the page) and handling the transitions more gracefully (like having a "loading" spinner).