Forums › Forums › Search & Filter Pro › Cannot get AJAX results to show on same page as form
- This topic has 7 replies, 2 voices, and was last updated 10 years, 6 months ago by Ross.
-
Anonymous(Private) June 3, 2014 at 4:23 pm #1179
1. v1.1.5 installed on WP 3.9.1
2. S&F Pro works when (non-ajax) results are sent to separate page (template = search.php)
3. When attempting to send the results to the same page using AJAX the content area fades but no results are displayed.
4. After a few failed attempts, the following setup is documented in the video, below.
– Starting page …/reference/filter/ (Private site)
– Template for …/reference/filter/ is search-landing.php (copied from search.php)
– Template referenced for search form: search-landing.php
– Content selector: #contentPlease see video >> http://screencast.com/t/yyINwOIsiq
Note there is a pause of about 8 seconds in the middle of the video while a tab is switched. Please view the entire video.
Thanks for your help. I know I must be doing something stupid.
(It would be good if you could provide us with a basic setup including a demo php template and detailed instructions to get the results to show in the same page as the filter form. We are not all WP developers.)
Ken Z
Ross Moderator(Private) June 3, 2014 at 4:57 pm #1185Hey Ken
Thanks for the vid makes things easier –
What the URL for your homepage?
Your right about the documentation thats my plan for this week!
Thanks
RossRoss Moderator(Private) June 3, 2014 at 5:40 pm #1200Hey Ken
I think the problem is, if you want to use AJAX, then the results page must match the layout of the page you sent me – so they must use the same page template…
So, because you want to use AJAX
Your results page (http://klc.wpengine.com/?sfid=Wt) and your main search page (http://klc.wpengine.com/reference/filter/) must use the same page template (they must look the same with the same/similar DOM strucutre) – right now they look completely different.
Anonymous(Private) June 3, 2014 at 5:54 pm #1205I thought my main search page and my results page are the same. Not sure where ‘/?sfid=Wt’ came from or how to change the associated template. It appears in the ‘set a slug’ field in SandF but I didn’t put it there.
Maybe I have to change the ‘set a slug’ to something that represents the ‘main search page’ to tell the system to put the results on the same page?
Maybe best to wait for your more detailed explanation?
KZ
Ross Moderator(Private) June 3, 2014 at 6:02 pm #1206Hey Ken, Search & Filter creates this automatically for your results pages every form you create has its own unique id, and when that is in the URL, a search is performed..
So you did not create this, it is auto generated (you can see it in the
slug
section) – this page is always your results page for this form, and it uses all the settings defined in your search form, such as loading a custom template –search-landing.php
You’ll see, if you submit the form without AJAX, the URL will update and you can find an
sfid=***
…What you need to do is make sure this results page (http://klc.wpengine.com/?sfid=Wt) uses the same page template as this one – http://klc.wpengine.com/reference/filter/ – so when you access both the URLs, you will have the same layout.
But currently they look completely different, so update the custom template filename in S&F settings to match.
Make senses?
Anonymous(Private) June 3, 2014 at 6:59 pm #1208OK. Thanks for being patient.
As is shown in the video, the template entered in the SF settings is ‘search-landing.php’. This is a copy of the standard search.php.
http://klc.wpengine.com/reference/filter/ also uses ‘search-landing.php’. I selected it from the templates dropdown.
Why do they look different? Hmmmm. This theme (Weaver II) allows customization to the page by selecting, deselecting sidebars, footers, etc from the page editor screen. Maybe that is giving me the problem.
I will have to continue to experiment with this. Perhaps you could provide sample php files that are working as an example when you put your documentation together.
Thanks,
Ken ZRoss Moderator(Private) June 4, 2014 at 11:27 pm #1279Hey Ken how are you getting on?
Yeah it looks like some modifications to the layout from you theme which don’t seem to work with static templates…
If you can begin modifying the search results template with your theme then your on to a winner.
The search results page is much like an archive page, rather than a standard post/page so maybe look at how you can modify your archive pages using your themes editing capabilities which will hopefully give you a good start for modifying the search page… 🙂
-
AuthorPosts