Daily chess puzzle

Daily chess puzzle

Show the daily chess puzzle on your website

You can show the daily chess puzzle on your website or blog with the following code:


<div>
    <a id="puzzleLink" href="https://chesspuzzle.net/Daily">
        <img id="puzzleImage" alt="Daily chess puzzle" />
    </a><br />
    <h3><span id="puzzleText" /></h3>
</div>

<script type="text/javascript">
    var request = new XMLHttpRequest();
    request.open('GET', 'https://chesspuzzle.net/Daily/Api', true);
    request.onload = function () {
        if (request.status >= 200 && request.status < 400) {
            var result = JSON.parse(request.responseText);
            document.getElementById("puzzleText").textContent = result.Text;
            document.getElementById("puzzleLink").href = result.Link;
            document.getElementById("puzzleImage").src = result.Image;
        }
    };
    request.send();
</script>