Forums › Forums › Search & Filter Pro › How to load form with ajax?
Tagged: ajax
- This topic has 11 replies, 2 voices, and was last updated 8 years ago by Trevor.
-
Anonymous(Private) October 24, 2016 at 8:33 pm #66106
I have been using multiple forms which were loading at the same time and I was hiding/showing them on dropdown with display: none/block. This seemed to work at first but then I’ve noticed that after using pagination and switching between forms, some of the auto generated dropdown lists were empty.
I assume that this is happening because I have multiple forms loaded in my HTML at the same time? Could usage of Ajax stop this and if so, how could I load your search form with it? Any tutorials?
Thanks!
Anonymous(Private) October 26, 2016 at 12:18 pm #66582Good news! It seems that I was able to solve the problem. But it had nothing to do with the new version of your plugin.
The problem was outside of the forms (my jQuery code) but yet related to the forms. I’ve noticed that dropdown values update once I click on the empty option, like this: Town name (0). Which made me realize that something is making your plugin to hiccup, so to speak.
I’m using some outside of the form dropdowns and radio buttons to make the switching between the forms more dynamic and eye pleasing. In order to do that, 2 dropdown fields of your form are hidden and are showing only one value, example: apartment/house/flat and rent/sale. I was using this line:
$("li.sf-field-taxonomy-taxonomy option:last-child").attr('selected', 'selected');
It made the hidden sf dropdown field select the value I wanted instead of “select all” option. So I removed that part of the code and used “Tags, Categories & Taxonomies” tab to simply include one value for each field, so the dropdown values can have “select all” activated because they are only getting one value anyway and are hidden so it is not looking weird.
I don’t know if this makes any sense but I just wanted to explain exactly what happened. 🙂
P.S. I activated the new plugin version following your instructions and everything worked as before, but not a single new feature was there? Is it possible that the plugin didn’t “refresh”, so to speak? I activated/deactivated it multiple times after being replaced.
All in all, the problem is solved but I’m a little bit curious about the above. 🙂
-
AuthorPosts