Can I pass a parameter using ajax using an anchor link?

I am wanting to create an option whereby the user can choose between what sort of view my listview widget uses.

I found the following question on stackoverflow which does give part of the answer however I am unsure on how to setup anchor links/buttons up so that when one is clicked the listview item view options is changes preferably via ajax however checking for URL parameter would also be okay (however I am unsure on how to post parameter on click).

Stackoverflow suggest the following which seems cool but can it be done via ajax?

<?= ListView::widget([

    'itemView' => Yii::$app->request->get('advanced-view') ? '_advanced-view' : '_basic-view',

]) ?>

You can try pjax

It will update the url get params and reload the part between pjax start and pjax end