September 20, 2015 at 1:13 pm #166151
I have something I'd like to accomplish, though I'm not sure if it's possible or not.
I'll have a page, such as example.com/types
From the /types page, you'll be able to AJAX search the different types, typeA, typeB, typeC, etc. This will result in different results displayed at the same URL of example.com/types
Is it possible to have the primary navigation have links to the example.com/types pages, where the page loads with the AJAX query already searched? For instance, if I clicked on the primary navigation of TypeB, can I load example.com/types, with the AJAX area already displaying the results of TypeB? The idea is to load the same URL (example.com/types), while still automatically displaying the specific information of certain queries. I know you can query in the URL, but that's not what I'm trying to do.
I'd love to learn anything I can about this, let me know!
September 20, 2015 at 2:58 pm #166166Victor FontModeratorSeptember 20, 2015 at 3:25 pm #166168
If you're referring to category archive pages, that's not what I'm looking for. I'm using custom post types, and advanced custom fields to sort a large variety of data (could very well be custom taxonomies, but it doesn't really matter). The idea is that there are infinite combinations of queries, such as:
hotels + bars
Hotels + restaurants + delivery food
Hotels + bars + Take Out
Restaurants + Chinese + Delivery
The list goes on and on, and the additions to the queries have plenty of other examples. The idea is that there's a central example.com/venues page, which lists ALL venues. On this page, you can filter (using AJAX), and display only the venues you want to see (like the above queries), while staying on example.com/venues. My question is, is there a way to land on example.com/venues (no queries in the url, or final url you land on if you redirect), with an AJAX query already on the page - for example, the page already shows bars + take out. The idea is to keep the user on the example.com/venues page, while allowing the flexibility to search through venues (while being exposed to the other static content on this page, that doesn't change with the filtering). I want to have navigational links that lead to this page, with the AJAX area already displaying specific information.
September 20, 2015 at 5:51 pm #166171Victor FontModerator
If you don't want to use query strings in the URL, you are most likely looking at using jQuery.Ajax in a document onload function. I haven't done this myself, but this is where I would start: http://api.jquery.com/jquery.ajax/. Hope it helps.
September 20, 2015 at 6:21 pm #166173
- The forum ‘General Discussion’ is closed to new topics and replies.