Forums › Forums › Search & Filter Pro › ajaxformfinish wont run my code
Tagged: ajax
- This topic has 18 replies, 2 voices, and was last updated 4 years, 11 months ago by Trevor.
-
Anonymous(Private) November 27, 2019 at 4:04 pm #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(Private) November 28, 2019 at 7:54 am #227902The 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(Private) November 28, 2019 at 8:09 am #227904You 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(Private) November 29, 2019 at 8:13 am #227962The 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
-
AuthorPosts