Plugin

Developer
Supported

AJAX Pagination

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Laisvunas

     

You must be logged in to post.

Plugin doesn’t work in my case

Support Request

Alur
Alur

Hello!

I use plugin as described in the first example. So the code of my embed template global/index_tests:

<div id="last_tests_wrapper">
    <
div class="last_tests">
        <
div class="last_tests_title">
            
Last tests
        
</div>
       
        
{exp:ajax_pagination:wrapper 
           ajax_container
="ajax_container" 
           
embed_template_url="http://beertoptest.ru/index.php/global/index_tests" 
           
parse="inward"
        
}

        {ajax_pagination_container_top}
        
<div id="ajax_container">
        
{/ajax_pagination_container_top}


        {exp
:channel:entries channel="beers" limit="6" dynamic="yes" paginate="bottom" parse="inward"}
        
<div class="last_tests_item">
            <
a href="{url_title_path='beer'}">
                <
div class="last_tests_item_title">
                    <
div class="last_tests_item_img">
                        
{if pictures}
                        {pictures orderby
="isFace" sort="desc" limit="1"}
                            {pictures
:picture:recent_test wrap="image"}
                        {
/pictures}
                        {if
:else}
                            
<img src="/images/uploads/beers/no-beer-small.png" alt="">
                        
{/if}
                        {
!-- <img src="/img/beer/asterie.jpg" alt=""> --}
                    
</div>
                    <
div class="last_tests_item_name">{title}</div>
                </
div>
                <
div class="last_tests_item_type">
                    
{if style != ""}
                        {style}
                    {if
:else}
                        
Empty
                    
{/if}
                    
                
</div>
                <
div class="last_tests_item_block">
                    <
div class="last_tests_item_country">
                        
{if country}
                            
<img src="/images/uploads/countries_flags/_small/noflag.png" alt="">
                        
                        
{if:else}
                            {country}
                            {country
:country_flag:small wrap="image"}
                            {
/country}
                        {
/if}
                    
</div>
                    <
div class="last_tests_item_strength">{ABV}%</div>
                    <
div class="last_tests_item_rating">{archive_vote_mark}</div>
                </
div>
            </
a>
        </
div>
        
     
{if count == total_results}</div>{/if}
     {paginate}
        {exp
:ajax_pagination:links}
        {pagination_links}
        {
/exp:ajax_pagination:links}
     {
/paginate}
     {
/exp:channel:entries}

     {ajax_pagination_container_bottom}
     
</div>
     
{/ajax_pagination_container_bottom}

     {
/exp:ajax_pagination:wrapper}
</div

But when I click to any paginate link I have:

The following errors were encountered

The action you have requested is invalid

Return to Previous Page 

What’s wrong?

Laisvunas
# 1
Developer
Laisvunas

Hi,

It seems that the issue is related to XID handling.

These steps may solve the issue:

1) Download and install the version 1.2 of this plugin (I just uploaded it);

2)  put this part of your code into main template:

<div id="last_tests_wrapper">
    <
div class="last_tests">
        <
div class="last_tests_title">
            
Last tests
        
</div>

...
...
... 

</
div>
</
div

3) Add parameter “xid_element_id” to exp:ajax_pagination:wrapper tag and the element containing XID value.

After sthe steps (2) and (3) your embed template will look like this:

{exp:ajax_pagination:wrapper 
           ajax_container
="ajax_container" 
           
embed_template_url="http://beertoptest.ru/index.php/global/index_tests" 
           
xid_element_id="infinite_scroll_xid"
           
parse="inward"
        
}

        {ajax_pagination_container_top}
        
<div id="ajax_container">
        
{/ajax_pagination_container_top}

       
<input type="hidden" id="infinite_scroll_xid" value="{XID_HASH}">


        
{exp:channel:entries channel="beers" limit="6" dynamic="yes" paginate="bottom" parse="inward"}
        
<div class="last_tests_item">
            <
a href="{url_title_path='beer'}">
                <
div class="last_tests_item_title">
                    <
div class="last_tests_item_img">
                        
{if pictures}
                        {pictures orderby
="isFace" sort="desc" limit="1"}
                            {pictures
:picture:recent_test wrap="image"}
                        {
/pictures}
                        {if
:else}
                            
<img src="/images/uploads/beers/no-beer-small.png" alt="">
                        
{/if}
                        {
!-- <img src="/img/beer/asterie.jpg" alt=""> --}
                    
</div>
                    <
div class="last_tests_item_name">{title}</div>
                </
div>
                <
div class="last_tests_item_type">
                    
{if style != ""}
                        {style}
                    {if
:else}
                        
Empty
                    
{/if}
                    
                
</div>
                <
div class="last_tests_item_block">
                    <
div class="last_tests_item_country">
                        
{if country}
                            
<img src="/images/uploads/countries_flags/_small/noflag.png" alt="">
                        
                        
{if:else}
                            {country}
                            {country
:country_flag:small wrap="image"}
                            {
/country}
                        {
/if}
                    
</div>
                    <
div class="last_tests_item_strength">{ABV}%</div>
                    <
div class="last_tests_item_rating">{archive_vote_mark}</div>
                </
div>
            </
a>
        </
div>
        
     
{if count == total_results}</div>{/if}
     {paginate}
        {exp
:ajax_pagination:links}
        {pagination_links}
        {
/exp:ajax_pagination:links}
     {
/paginate}
     {
/exp:channel:entries}

     {ajax_pagination_container_bottom}
     
</div>
     
{/ajax_pagination_container_bottom}

     {
/exp:ajax_pagination:wrapper} 
Alur
# 2
Alur

Laisvunas, thank you very much!!!

It works after your recommendations.