Presetting search options via a custom URL

Setting search settings (checkboxes, dropdown etc..) via adding query arguments to current page URL

1) Navigate to the page with the search bar/settings you want to preset. In this example we are using the ajax search pro property demo example.

2) Preset the filters as you want them, for example:

3) Get your search ID. You can get the search shortcode ID on the plugin backend. In our case it is 16

4) Navigate back to the frontend with the search page. Now open your browser developer console via hitting F12. We are using Chrome. For other browsers CTRL + SHIFT + I may also work.

Make sure the console panel is highlighted:

5) Copy/Paste the following code to the console - but make sure to change the id variable to your search ID.

var id=16;
ASP.api(id, 'getStateURL');

The console should return a URL, which when used will preset the filters to the desired state.

If you want to also use a search phrase and/or trigger the search, then use this code instead. Change the phrase variable as you need it (it can be an empty string as well to only trigger the search).

This one enters a phrase and triggers the search:

var id=16, phrase='my search phrase';
ASP.api(id, 'getStateURL')+'&asp_s='+encodeURIComponent(phrase)+'&asp_id='+id;

This one only triggers with an empty phrase

var id=16;
ASP.api(id, 'getStateURL')+'&asp_s=&asp_id='+id;

In our case the console printed:

https://ajaxsearchpro.com/property-search/?p_asid=16&p_asp_data=1&current_page_id=2401&woo_currency=USD&qtranslate_lang=0&filters_changed=1&filters_initial=0&termset%5Breale-state-location%5D%5B%5D=53&termset%5Breale-state-location%5D%5B%5D=54&termset%5Breale-state-location%5D%5B%5D=46&termset%5Breale-state-location%5D%5B%5D=51&termset%5Breale-state-location%5D%5B%5D=47&aspf%5Bre_property_type__2%5D=Villa&aspf%5Bre_bedrooms__3%5D%5Blower%5D=4.00&aspf%5Bre_bedrooms__3%5D%5Bupper%5D=6.00&aspf%5Bre_bathrooms__4%5D%5Blower%5D=2.00&aspf%5Bre_bathrooms__4%5D%5Bupper%5D=6.00&aspf%5Bre_price__5%5D%5Blower%5D=380000.00&aspf%5Bre_price__5%5D%5Bupper%5D=760000.00&asp_gen%5B%5D=title&asp_gen%5B%5D=content&asp_gen%5B%5D=excerpt&customset%5B%5D=asp_real_estate&asp_s=&asp_id=16

6) Copy/Paste the URL returned. You can repeat the steps if you need multiple setups.