File size: 768 Bytes
a9ea03f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const commaFixingForm = document.querySelector(".comma-fixing-form");

const fixCommas = async (text) => {
    const inferResponse = await fetch(`baseline/fix-commas/`, {
        method: "POST",
        body: JSON.stringify({
            s: text
        }),
        headers: {
            "Content-type": "application/json; charset=UTF-8"
        }
    });
    const inferJson = await inferResponse.json();

    return inferJson.s;
};

commaFixingForm.addEventListener("submit", async (event) => {
    event.preventDefault();

    const commaFixingInput = document.getElementById("comma-fixing-input");
    const commaFixingParagraph = document.querySelector(".comma-fixing-output");

    commaFixingParagraph.textContent = await fixCommas(commaFixingInput.value);
});