hello.html 964 Bytes
Newer Older
Fia's avatar
Fia committed
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 26 27 28 29 30 31 32
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Hello, GNOME!</title>

        <style type="text/css">
            body {
                font-face: Cantarell, sans-serif;
                text-align: center; }
        </style>

    </head>
    <body>
        <input id="name-input" types="text">
        <button id="name-button">Submit Name</button>
        <p id="greeting"></p>
        <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
        <script>
            $("#name-button").click(function(event){
                let message = {
                    name: $("#name-input").val()
                }
                $.post("http://127.0.0.1:5000/hello", JSON.stringify(message), function(response){
                    $("#greeting").text(response.greeting);
                    console.log(response);
                });
            });

        </script>
    </body>
</html>