Forums Forums Search & Filter Pro no opacity change while loading results on custom display results

Viewing 10 posts - 1 through 10 (of 16 total)
  • Anonymous
    #267016

    Hi there,
    I am using a custom query for displaying the results. Search and results are on the same page.
    When a user clicks a checkbox, nothing happens while the results are loading. If I use a shortcode or the Divi Plugin, the contents opacity changes to 0.5 while loading the results.
    I need some sign, that the results are loading. Alternativly I tried to show a loading animation.
    I tried this solution:

    $(".searchandfilter").on("sf:ajaxstart",function(){
    //show loader
    console.log("ajax start");
    });
    
    $(".searchandfilter").on("sf:ajaxfinish",function(){
    //hide loader
    console.log("ajax complete");
    });

    but there is no logging in the console.
    I don’t know what goes wrong and need some help.
    Kind regards
    Sandra

    Trevor
    #267059

    I am not sure how you placed these on the page, but the best test method is to place them in a Text widget of some sort, inside script tags.

    How did you add the code to the page?

    Anonymous
    #267068

    Hi Trevor,
    thanks for your reply.
    You can see filter and results on this page: https://gesunder-wmk.de/zzzzzzzzztest-mehr-wissen/

    This code:
    ———————————
    <?php
    $args = array(
    ‘posts_per_page’ => 100,
    ‘order’ => ‘DESC’,
    ‘orderby’ => ‘title’,
    ‘post_type’ => ‘mehr-wissen’,
    );
    $args[‘search_filter_id’] = 5565;
    // the query
    $the_query = new WP_Query( $args );
    if ( $the_query->have_posts() ) :
    // the loop
    while ( $the_query->have_posts() ) : $the_query->the_post();
    ?>
    <div class=”mw-wrapper”>
    <div class=”mw-header”>
    <figure><?php the_post_thumbnail(); ?></figure>
    <div class=”headlines”>
    <h2><?php the_title(); ?></h2>
    <?php if(get_field(‘headline_2’)) { echo ‘<h3>’ . get_field(‘headline_2’) . ‘</h3>’; } ?>
    <?php if(get_field(‘subline_zu_headline_2’)) { echo ‘<p>’ . get_field(‘subline_zu_headline_2’) . ‘</p>’; } ?>
    </div>
    </div>

    <div class=”mw-content”>
    <?php the_content(); ?>
    </div>
    </div>

    <?php
    endwhile;
    // end of the loop
    wp_reset_postdata();
    else :?>
    <p><?php _e( ‘Sorry, no posts matched your criteria.’ ); ?></p>
    <?php endif;
    ?>
    ——————————–
    I added the code by creating a divi module with the plugin Divi Module Builder by Divi Plugins.

    Greetings
    Sandra

    Trevor
    #267072

    The search form seems to be reloading the page (Ajax will not trigger). Is Ajax enabled in the form?

    Anonymous
    #267081

    I think so.
    In Display Results/Ajax “Load Results using Ajax” is checked:
    Screenshot Display Results

    Trevor
    #267083
    This reply has been marked as private.
    Anonymous
    #267085
    This reply has been marked as private.
    Trevor
    #267148

    Is it because you are using Divi to display the results I wonder? Did you try using our Divi Extension plugin?

    Anonymous
    #267173

    I need to customize the results, so the Divi Extension plugin is not the right solution in this case.
    But I used a custom query as you can see above in the code. Is there a difference between using the shortcode or using the custom query?

    Anonymous
    #267221

    Hi all, So what was the outcome?

    using this:
    $(“.searchandfilter”).on(“sf:ajaxstart”,function(){
    //show loader
    console.log(“ajax start”);
    });

    $(“.searchandfilter”).on(“sf:ajaxfinish”,function(){
    //hide loader
    console.log(“ajax complete”);
    });

    I see ajax is working but no console logs….

Viewing 10 posts - 1 through 10 (of 16 total)