Viewing 3 replies - 1 through 3 (of 3 total)
  • You can do a “hijack” of the widget form submit and then use AJAX to load in the results to your existing page.
    Something like this worked for me (using jQuery):

    $('.taxonomy-drilldown-checkboxes').submit(function() {
    		// catch the form's submit event
    		target_el = $('div.target');
    
    		target_el.empty().html('<br/><h2>Please wait, loading...</h2>');
    	    $.ajax({ // create an AJAX call...
    	        data: $(this).serialize(), // get the form data
    	        type: $(this).attr('method'), // GET or POST
    	        url:  $(this).attr('action'), // the file to call
    	        success: function(response) { // on success..
    
    	        	// update the DIV - uses the "archive" template.
    	        	target_el.html($(response));	        	     
    
    	        }
    	    });
    	    return false; // cancel original event to prevent form submitting
    	});

    Hi mypixel,

    I have been trying to follow your suggestion above. I’d like to implement this using ajax. I have one query though. Can you show your server side PHP code that responds to the AJAX call? I’d like to see how you implement the GET query in the data on the server side to set the query parameters for selecting only the relevant posts that meet the selection criteria. I can’t quite figure how to do that.

    Thanks.

    Hi @mypixel, sorry to revive this old post but I used your snippet successfully and it works. I’m facing some issues with it though and want to see if you can help me.

    The code works perfectly until you paginate stuff. Let’s suppose that you have a custom post type and you list all posts with a regurlar WP_Query, then if you paginate it and you’re in page 2 this won’t show anything when you try to apply filters.

    I also added infinite scroll (which is the way I want to do) to this applied to the .target div. It makes that the URL doesn’t change so I’m able to go to the archive even if I’m on page 3.

    The issue under this setup is that when you applied filters and then you get paginated results, when you scroll down to make infinite start working it starts querying posts outside the chosen taxonomies filter/s.

    If you want to take a look at my code please let me know and I will be happy to show you.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ajax support’ is closed to new replies.