How can I go about passing data from a HTML form to a JavaScript file that handles AJAX calls

How can I go about passing data from a HTML form to a JavaScript file that handles AJAX calls?

submission_form.php

<?php echo elgg_view("input/file", array("name" => "icon", "class" => "icon")); ?>

<p>
    <?= elgg_view('input/text', ["name" => 'title', "class" => "title"]); ?>
</p>

submit.js

function myajax_function(){
    var Ajax = require('elgg/Ajax');
    var ajax = new Ajax();

    ajax.action('service_comments/add_service_comment', {
        data: {
            picture: 1,
            description: 2
        },
    }).done(function (output, statusText, jqXHR) {
        if (jqXHR.AjaxData.status == -1) {
            return;
        }
        alert(output.sum);
        alert(output.product);
    });
}

action file : submission_form.php

// Not working
$title = get_input('title');

// I'm not sure how to go about extracting the file from input/file and text from input/text

Thank you all in advance

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking