JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://example.com/go-to-link-1?paramA=1">test line #1</a>
<a href="http://example.com/go-to-link-2?paramB=1">test line #2</a>
<a href="http://example.com/go-to-link-3">test line #3</a>
<a href="http://example.com/go-to-link-4?paramA=1&paramB=1">test line #4</a>

CSS

a{
  display:block;
}

JavaScript

$(function() {
  $('a[href]').attr('href', function(index, href) {
    var url = new URL(href);
    url.searchParams.set('ajax',1);
    return url;
  });
})