I use Pjax on the site that I create, and after searching around, I could not find a way to save user data for later search. This is my code:
var myData = {
tst1: "some value",
tst2: "some other value"
};
$(document).pjax('a[pjax]', '#content', {
fragment: '#content',
timeout: 3000,
data: myData
});
When I try to write event.state.data to the "pjax: popstate" event, I get undefined.
$(document).bind("pjax:popstate", function(event) {
console.log(event.state.data);
});
Can someone tell me what I'm doing wrong?
source
share