Skip to content

Instantly share code, notes, and snippets.

@simonmcmanus
Last active December 15, 2015 10:29
Show Gist options
  • Save simonmcmanus/5246027 to your computer and use it in GitHub Desktop.
Save simonmcmanus/5246027 to your computer and use it in GitHub Desktop.
PJAX as Page.js middleware.
var frax = function(context, next) {
if(!context.init) {
$.get(context.canonicalPath+'?_pjax=true', function(markup) {
if(context.delay) {
context.pending = markup;
}else {
context.container.html(markup); // cached $('#container')
}
next();
});
}else {
next();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment