By jQuery, you can call server API by jQuery.ajax() in synchronus/asynchronous manner, and use that response on your code. The parameter can be added to FormData() in real-time.

Below code shows an example to get the processed result from server and display its result by alert().

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<script>
function getResult()
{
    var fd = new FormData();
    fd.append("name", document.MainFrm.uname.value);
    jQuery.ajax({
        url: "ajax.php",
        type: "post",
        data: fd,
        contentType: false,
        processData: false,
        async: false,
        success: function(response)
        {
            alert(response);
        }
    });
}
</script>

<form method=post name=MainFrm>
    <table>
    <tr>
        <td>Name <input type=text name="uname" value="Chun Kang"></td>
        <td><input type=button value="Get Result" onClick="javascript:getResult();"></td>
    </tr>
    </table>
</form>


ajax.php
<?php

extract( $_POST);

echo "Hey {$name}, howdy?";

?>