defunkt/jquery-pjax — pull request #214 by jejacks0n (2012-10-15 04:27:36+00:00)
Title: Provides a strategy for providing additional data to pjax.

Using an X-PJAX-DATA response header you can provide additional information to pjax that will persist in the history state. I'm using this to pass back JSON which is then parsed and used to set a class on the body etc. It works on history as well as ajax requests. An example of how I'm using it:

$(document).pjax('a', container: '#content').on 'pjax:end', ->
try data = JSON.parse($.pjax.state.data)
catch e then data = {}
// do whatever you'd like with your data.