defunkt/jquery-pjax — Issue #97: Using original ajax options in popstate
Author: nickhoffman
Created: 2012-02-22 05:28:31+00:00
State: open

On one of my pages, my pjax request sends a custom header. Eg:

```javascript
var request = $.pjax({
headers: {'X-SL-CONTEXT': 'sort and filter'},
url: url,
timeout: 0,
container: container,
fragment: container
});
```

In popstate events, that custom header should be sent. Unfortunately, it isn't.

One solution is to patch jquery-pjax so that it stores the `headers` object in the `state` object, and sends the headers in popstate events.

That feels like a lame solution, because other options might've been passed to the original `$.pjax()` call that should be included in popstate events, such as `accepts`, `data`, etc. Because of that, I feel like all of the options that are passed to `$.pjax()` that can be serialized should be stored in the `state` object.

What do you guys think?