如何通过单击链接更改wordpress query_posts参数?

i have an arguments to display my post using WP_query post. I have a link that is something a list of category items. For example, i have categories which is: Products,Services and Clients. When i click the Products it will automatically change my query post and if click the services automatically change into services posts. Also i want to add ajax for it to stop loading the page. How can i do it ? Please help me to do this. I am new in wordpress. Where would i add the ajax script ? and then change the click post to change the category.

<?php
    $args = array(
        'post_type' => 'post',
        'category_name' => 'products',
        'posts_per_page' => '6',
    );
    $productsBlog = new WP_Query( $args );

    $count = 0;
    if( $productsBlog->have_posts() ) : 
?>

You can try this snippet

Make sure you provide post_type argument in your ajax request if you use custom post types.

Add paged query variable to enable pagination.

 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
// where $paged should be used in your arguments along with category_name,post_type_posts_per_page etc