JSFiddle - React, Tailwind, and code Playground

HTML

<form id='form1'> <span class="ajaxContent">&nbsp;</span>
Введите имя:
    <br/>
    <input name="ajax[name]" type="text" size="20" />
    <input name="ajaxFilePhp" value="test.php" type="hidden" />
    <input type="submit" value="Отправить" />
</form>

<form id='form2'> <span class="ajaxContent">&nbsp;</span>
Введите имя:
    <br/>
    <input name="lalal" value="1234" type="hidden" />
    <input type="submit" value="Отправить" />
</form>

JavaScript

$("#form1, #form2").submit(function () {
    console.log($(this)); // <-- в $(this) содержится указатель на форму
    return false;
});