Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
859 B
11
Indexable
Never
<!DOCTYPE html>
<html>
    <head>
        <title>Tester</title>
        <script>
        let id = prompt("Insert Game ID");
        let url = http://localhost:8080/https://www.boardgamegeek.com/xmlapi2/thing?id=${id};
        const req = new XMLHttpRequest();
        req.open("GET", url, false);

            req.send(null);
        </script>
    </head>
    <body>
        <p id="catanName"></p>

        <script>
            let parser, xmlDoc, catanName;
            let text = req.responseText;
        console.log(text);

            parser = new DOMParser();
            xmlDoc = parser.parseFromString(text, "text/xml");

            catanName = document.getElementById("catanName");
            catanName.innerHTML = xmlDoc.getElementsByTagName("name")[0].getAttribute('value');
            </script>

    </body>
</html>