Search code examples
ajaxpjax

force ajax request on back and forward button with pjax


This call to pjax works and it replaces div-section with response from url. For tabbed navigation, pjax successfully changes url as well

$.pjax({
        url: $this.attr("href"), 
        container: '#div-section', 
        push: true
}).done(function() {
        $object.init();                 
});

But back and forward chrome button don't resend Ajax request and its cached in browser. Also below setting is enabled to not force full refresh.

$.pjax.defaults.timeout = false;

how can ajax request be forced on back and forward button with pjax ?


Solution

  • Found solution for it

    $.pjax.defaults.maxCacheLength = 0;