Ajax Submit on Page Load with Ultimate WP Query Search Filter Plugin

This is a great way to get trigger content loading on the page automatically. Visitors can then use filters enabled in the Search Filter to customize their search.

Place the below function within script tags before the closing </body> element. This will target all UWPQSF forms by ID and load their content automatically.

jQuery(document).ready(function($) {
	$('[id^=tdp-] option[value="<?php echo $select_value?>"]').attr("selected", "selected");
     
    function loadAjax(){
	
	    var obj = $("[id^=uwpqsffrom_]");//remember to replace the form id
        process_data(obj);
                 return false;
    
        }
        window.onload = loadAjax;
});

Sourced here.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.