Just to make sure we're on the same page here:
PHP: runs on the server, which outputs HTML (or whatever) the browser
<?php if(isset($_POST['submit'])): ?>
<?php endif; ?>
<p>Goodbye, cruel world.</p>
But if the objective is to have the PHP script actually do whatever it is that the AJAX function does while still processing on the server, then you're looking at directly calling the target of the AJAX request directly (/php/query/transactions.php in this case, possibly by include()ing directly, or else via HTTP such as with the cURL extension for PHP.
But all that's theoretical at the point until at least I better understand exactly what needs to happen.