JSFiddle - React, Tailwind, and code Playground

HTML

<form action="a.php">
    <input type="text">
    <input type="text">
    <input type="text">
    <button type="submit" class="submit_to_a">goes to a</button>
</form>
<form action="a.php">
    <input type="text">
    <input type="text">
    <input type="text">
    <button type="submit" class="submit_to_a">goes to a</button>
</form>
<form action="b.php">
    <input type="text">
    <input type="text">
    <input type="text">
    <button type="submit" id="gotob">goes to b</button>
</form>
        <form action="c.php">
    <input type="text">
    <input type="text">
    <input type="text">
    <button type="submit" id="gotoc">goes to c</button>
</form>

JavaScript

$('.submit_to_a').parent('form').on('submit', function (e) {

      e.preventDefault();

      $.ajax({
        type: 'post',
        url: 'a.php',
        data: $(this).serialize(),
        success: function () {
        }
      });

    });


$('#gotob').parent('form').on('submit', function (e) {

      e.preventDefault();

      $.ajax({
        type: 'post',
        url: 'b.php',
        data: $(this).serialize(),
        success: function () {
        }
      });

    });

$('#gotoc').parent('form').on('submit', function (e) {

      e.preventDefault();

      $.ajax({
        type: 'post',
        url: 'c.php',
        data: $(this).serialize(),
        success: function () {
        }
      });

    });