Last active
December 15, 2015 10:29
-
-
Save simonmcmanus/5246027 to your computer and use it in GitHub Desktop.
PJAX as Page.js middleware.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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