Forums Forums Search & Filter Pro ajaxformfinish wont run my code

Tagged: 

Viewing 9 posts - 11 through 19 (of 19 total)
  • Trevor
    #227804

    Try loading it as a separate function, inline on the page (inside script tags), maybe in a text widget?

    Anonymous
    #227809

    got it now inside this script.

    <div class="filter-container">
    							<?php echo do_shortcode('[searchandfilter id="138"]'); ?>
    							<div class="weergave-switch">
    								<a class="lijst switch">Lijstweergave</a>
    								<a class="situatie switch">Situatieweergave</a>
    								<script type="text/javascript">
    									$(function(){
    										$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
    										    console.log("ajax finish");
    										    // your code
    										});
    										$(document).on("sf:ajaxformfinish", ".searchandfilter", function(){
    											console.log("ajax complete");
    											// your code
    										});
    									});
    								</script>
    							</div>
    						</div>

    or should i place it on the results page so the search-filter/138.php in my case?

    Anonymous
    #227811

    sorry for my code i couldnt edit it.

    Trevor
    #227813

    It needs to be on the results page. In that code I don’t see the results shortcode?

    It can work inside the results.php file, but not inside the if and while loops.

    Anonymous
    #227902

    The results shortcode was outside that div.

    i place the code in the results page now like this:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    ?>
    <script type="text/javascript">
    	$(function(){
    		$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
    		    console.log("ajax finish");
    		    // your code
    		});
    		$(document).on("sf:ajaxformfinish", ".searchandfilter", function(){
    			console.log("ajax complete");
    			// your code
    		});
    	});
    </script>
    <?php
    if ( $query->have_posts() )
    {
    	?>
    	<div class="woningzoeker-container">	
    		<?php
    		while ($query->have_posts())
    		{
    			$query->the_post();
    			
    			?>

    but still don’t get the console logs.
    if placed it outside the if and while loop as you told.

    Trevor
    #227904

    You have this:

    <script type="text/javascript">
    	$(function(){
    		$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
    		    console.log("ajax finish");
    		    // your code
    		});
    		$(document).on("sf:ajaxformfinish", ".searchandfilter", function(){
    			console.log("ajax complete");
    			// your code
    		});
    	});
    </script>

    Can you try this:

    <script type="text/javascript">
    	$(function(){
    		$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
    		    console.log("ajax finish");
    		    // your code
    		});
    	}(jQuery));
    	$(function(){
    		$(document).on("sf:ajaxformfinish", ".searchandfilter", function(){
    			console.log("ajax complete");
    			// your code
    		});
    	}(jQuery));
    </script>
    Anonymous
    #227906

    Changed it but the same results.

    Anonymous
    #227962

    The problem is still there, because this website have a deadline soon i’m gonna use ut to reload te page so turn ajax off this is not the desire way to work, but for now it will be.

    I gonna make another test case when the website is live.
    If you have some more additions to test please tell me.

    thanks for the help so far hope we can fix this in the near futher!

    Wilco

    Trevor
    #228007
    This reply has been marked as private.
Viewing 9 posts - 11 through 19 (of 19 total)