Pjaxhole is an attempt to play with Pjax using Sinatra as a data provider.
- Ajax, with benefits
- Permalinks, page titles, and back buttons that work
- Timeout and error failover to traditional web request
- Call it on a link
$(link).pjax()
or call it like Ajax$.pjax()
- Only works on browsers supporting
pushState
- This shit is slick
I don't think it's really comparable. The syntax is hairy right now, but all it really amounts to is:
- Define a container for Pjax updates to load into
redirect_pjax_to
in the controller
It is somewhat similar to RJS in that the abstraction is looking ugly. The technique in this Sinatra example seems more clear to me:
- Write the JS to do Pjax, triggered on links and updating a container
- Detect Pjax header and avoid rendering layout if it is there
Maybe Rails will come up with a better syntax yet...
- ENJOY! the Pjax jquery plugin source
- BATHE IN! the Pjaxhole implementation
- LOOK AT WITH YOUR EYES! Pjaxhole in its full glory
Created by Barry Hess.
Pjax is not mine, nor is Sinatra.
Copyright (c) 2011 Barry Hess. Released under the MIT license.