MODX Community

pdoPage and History API back button JSON output

I have an issue with pdoPage with ajax enabled where it randomly displays the JSON output when navigating back from a child page using the browser back button. Happens intermittently on desktop but more frequently on mobile using chrome browser.

[[!pdoPage:default=`<div class="cell small-12"><p class="no-results text-center">No insights found</p></div>`?
    			&element=`pdoResources`
    			&where=`[[!TaggerGetResourcesWhere? &matchAll=`1` &tags=`[[!queryString:urldecode? &field=`expertise`]],[[!queryString:urldecode? &field=`enlightened-thinking`]]` &where=`{"template":[[!queryStringTemplate:urldecode? &field=`content-type`]]}` ]]`
    			&includeTVs=`author,primaryTag,time,featureImage`	
    			&limit=`12`
                &parents=`9`
    			&showHidden=`0`
    			&cacheTime=`0`
    			&sortby=`publishedon`
    			&setTotal=`1`
    			&totalVar=`results`
    			&ajax=`1` 
                &ajaxMode=`default`
    			&ajaxElemWrapper=`#pdopage`
    			&ajaxElemRows=`#pdopage .grid-x`
    			&scrollTop=`1`
    			&frontend_js=`//[[!++http_host]][[!++base_url:htmlent]]assets/template/js/_manager/pdo.page.scroll.js`
    			&frontend_startup_js=`startjs`
    			&frontend_init_js=`initjs`
    			&tplCondition=`template`
    		    &conditionalTpls=`{"30":"insightVideoTpl","31":"insightPodcastTpl","32":"insightGuideTpl" }`
    			&tpl=`insightTpl`
    			[[$pagination-styles]]
        ]]

Browser was caching Ajax request.

On 169 https://github.com/bezumkin/pdoTools/blob/febdd7dbe2bcbee501d132e801e57f658f54bd59/assets/components/pdotools/js/jquery.pdopage.js

Changed from $.get to $.ajax with cache:false setting

1 Like