Forums › Forums › Search & Filter Pro › ajax problem filtering
Tagged: ajax error, ajax filtering, yootheme
- This topic has 2 replies, 2 voices, and was last updated 5 years, 6 months ago by Trevor.
-
Anonymous(Private) May 8, 2019 at 6:50 am #210369
Hello
https://www.gorilla-glue.com/gorilla-productsi get this error in console, the ajax doesn t filter the results
QMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:542
Custom Theme JS Code: TypeError: “$ is not a function”
<anonymous> http://www.gorilla-glue.com/gorilla-products/:75
gorilla-products:99:16
<anonymous> http://www.gorilla-glue.com/gorilla-products/:99
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.gorilla-glue.com/?sfid=232&sf_action=get_data&sf_data=results&_sft_category=gorilla-glues&lang=en. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).[Learn More]Anonymous(Private) May 8, 2019 at 6:56 am #210372https://www.gorilla-glue.com/gorilla-products/
problem was the link to the results page, i had to use https:// instead of http://
now ajax works but in my console i still get this error
JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:542
Custom Theme JS Code: TypeError: “$ is not a function”
<anonymous> https://www.gorilla-glue.com/gorilla-products/:88
gorilla-products:112:16Trevor(Private) May 8, 2019 at 10:58 am #210416It is this code you have loading inline on the page:
https://www.screencast.com/t/o8QIxXIa
It isn’t actually doing anything at this time, so should not be needed, but is incorrectly written anyway.
I think it should look like this:
try { //detects the start of an ajax request being made (function ( $ ) { "use strict"; $(document).on("sf:ajaxstart", ".searchandfilter", function(){ console.log("ajax start"); }); //detects when the ajax request has finished and the content has been updated // - add scripts that apply to your results here $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); //an event fired when S&F is initialised and S&F scripts have been loaded $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); }); //depending on where you add your JS, sometimes its necessary to wrap the above events in a function (as is standard practice): $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); }); }(jQuery)); } catch (e) { console.error('Custom Theme JS Code: ', e); }
-
AuthorPosts