Forums Forums Search & Filter Pro List/Grid switcher AJAX

  • This topic has 4 replies, 3 voices, and was last updated 7 years ago by Ross.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Trevor
    #181036

    Hi

    We do have events that you can watch for when Ajax is triggered. See the FAQ page for basic details. Maybe you could use these?

    https://searchandfilter.com/documentation/faq/

    Anonymous
    #181103

    Hi Trevor,

    I don’t need to detect the event, I need to modify the ajax request params. Do you know how I can achieve this?

    Cheers,
    Josh.

    Trevor
    #181110
    This reply has been marked as private.
    Ross Moderator
    #181437

    Hi Liam

    You can do it by modifying the results URL and adding your param there:

    function add_query_arg_to_results_url( $url,  $sfid) {
      // Process URL here
      return add_query_arg('view', 'grid', $url);
    }
    add_filter( 'sf_results_url', 'add_query_arg_to_results_url', 10, 2 );

    This is actually not the intended use of this filter, and there will likely be better way to do this in v3 (when it comes out)

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)