<commit_before>function form_to_query(form)
{
    var i;
    var q = form.action;

    for (i = 0; i < form.length; i++)
        if (form[i].value)
            q += "&" + form[i].name + "=" + form[i].value;
    return q;
}

function enter_player()
{
    var form, query;

    form = document.getElementById('form_enter_player');
    query = form_to_query(form);
    // TODO: send the query
    alert(query);
    // prevent default form submission (we do everything from this script)
    return false;
}<commit_msg>html: send the REST call on form submit<commit_after>function form_to_query(form)
{
    var i;
    var first_arg = true;
    var q = form.action;

    for (i = 0; i < form.length; i++)
        if (form[i].value) {
            if (first_arg) {
                q += "?";
                first_arg = false;
            } else
                q += "&";
            q += form[i].name + "=" + form[i].value;
        }
    return q;
}

function process_submit_response(response)
{
    alert("got this: " + response);
}

function enter_player()
{
    var form, query;
    var xhttp = new XMLHttpRequest();

    xhttp.onreadystatechange = function() {
        if (xhttp.readyState == 4 && xhttp.status == 200)
            process_submit_response(xhttp.responseText);
    }
    form = document.getElementById('form_enter_player');
    query = form_to_query(form);
    xhttp.open("GET", query, true);
    xhttp.send();
    // prevent default form submission (we do everything from this script)
    return false;
}
{'fraction_non_alphanumeric': 0.1345646437994723, 'fraction_numerical': 0.00395778364116095, 'mean_word_length': 2.334065934065934, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2600695', 'n_tokens_mistral': 494, 'n_tokens_neox': 477, 'n_words': 125}