Using pjax with Clojure and Noir: minimize client side Javascript code while maintaining fast page load times
I don't like doing a lot of client side Javascript (or Coffeescript) development. pjax is a way to minimize client side Javascript while maintaining fast page load times. I became interested in pjax after reading an article on the development of Basecamp Next. DHH indicated that they looked at pjax but then rolled their own similar system. Here is a github repo with a Clojure and Noir example web app using pjax that I wrote this morning. There were a few non-obvious aspects to using pjax with Noir so hopefully this will save you some time. If you don't want to grab the github repo, here are a few interesting code snippets. First, we need to run a little Javascript to process links to set up for AJAX calls setting a "X-PJAX" header: $(function(){ // Activate PJAX test links // Response will be loaded into #wrapper element $('a').pjax('#wrapper') }) I put this code in resoures/public/js/application.js which is loaded in the common Cloj