Forums › Forums › Search & Filter Pro › Results don't show with AJAX, but do without AJAX
- This topic has 30 replies, 3 voices, and was last updated 7 years, 11 months ago by Trevor.
-
Trevor(Private) December 2, 2016 at 9:05 am #73568
Sorry for not replying earlier. You would have needed to only use this bit of code:
$(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again });
And then wrap it as shown in this snippet:
(function ( $ ) { "use strict"; $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); }); }(jQuery));
So your base combined snippet becomes this:
(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); }(jQuery));
And then you need to replace the one commented line (
//so load your lightbox or JS scripts here again
) with the actual function that re-initializes whichever script your grid uses. If you are able to share a sample URL from your site with the grid on, I can take a look at the code to see what that function might need to be.Trevor(Private) December 3, 2016 at 8:17 am #73794Hi Rolla
Your site home page, where the search form is, is more complicated than you had said. It appears to have 5 loops; one each for Architecture, Iconography, Music, Minor Arts, and Theory. As such, the Ajax method is not likely to work. It would need to go to a page with a single category loop on it.
You may need to re-think how the search would work.
Anonymous(Private) December 3, 2016 at 3:30 pm #73834Thanks very much for the compliment. I understand what you are saying about the multiple loops. However, I also tried it on a basic page with only one loop though and still couldn’t get it to work. Were you able to identify the lightbox/JavaScript code that I would need to place in that commented line so I can at least finish the workaround to get it working on a basic page?
Anonymous(Private) December 3, 2016 at 3:57 pm #73838Sure, here you go:
http://oaj.flywheelsites.com/sort-filter/Anonymous(Private) December 3, 2016 at 4:09 pm #73840If it makes a difference in your troubleshooting, on that page (and the homepage) I am using the Display Posts plugin and shortcode to initiate the various loops within the pages.
Here is a page where I’m running just the basic WordPress loop code within my template instead of using the Display Posts shortcode and it’s still not working:
http://oaj.flywheelsites.com/sample-loop/Trevor(Private) December 3, 2016 at 4:11 pm #73842On that page’s (http://oaj.flywheelsites.com/sort-filter/) search form, can you change the results container to
.display-posts-listing
I can see no sign of any scripts working on the loop.
-
AuthorPosts