Quantcast
Viewing all articles
Browse latest Browse all 20145

Ajax load view

This has been asked a few times here, with no real solution offered.

Here's what I'm trying to do:
I've got a filter form that searches through my member profiles. The results would be a list of the member names, which can be clicked to view details. Details need to be loaded via ajax, so that the filter form stays intact.

I can see two ways of doing this:

1. Use a pagination slider.
This works pretty much exactly how I want it to. The problem with this approach is that neither the 'Links' option (a series of meaningless dots) or the 'Dropdown' option (a series of meaningless numbers). I would need to replace the useless dots/numbers with the actual member name (post title) being linked to.

There's a few threads on this very question, again no real solution. I've gone through <em>wpv-pagination-embedded.php</em>, but it doesn't give me access to all the posts returned by the filter, just the one currently displayed and the number of posts returned.

2. Display a list of links which load a view via ajax
The first part of this is pretty easy, just have the filter view return a list of links, add an onclick handler that triggers an ajax call to load the view for the post. Something along the lines of <em>onclick="do_shortcode('[wpv-view name='member profile' post_id=1]')"</em>. I've already used a filter to let the wpv-view shortcode use the post_id attribute to show only the specific post (see: http://wp-types.com/forums/topic/cant-get-render_view-to-show-a-specific-post/ ). Unfortunately, I can't figure out how to get javascript to execute a shortcode.

Either of these approaches would do what I need, I'm just not sure how to get them to the next level… either show a list of post titles instead of dots for approach 1, or load a shortcode via ajax for approach 2.

If somebody could point me in the right direction for either, I'd be more than happy to post a working solution once I've got it.

Thanks!

-m


Viewing all articles
Browse latest Browse all 20145

Trending Articles