Zeige das Puzzle des Tages auf Deiner Website an
Du kannst das Puzzle des Tages mit dem folgenden Code auf Deiner Website anzeigen:
<div>
<p>
<span id="puzzlePlayers"></span><br />
<span id="puzzleSite"></span>
</p>
<a id="puzzleLink" href="https://chesspuzzle.net/de/Daily">
<img id="puzzleImage" alt="Puzzle des Tages" />
</a><br />
<h3><span id="puzzleText" /></h3>
</div>
<script type="text/javascript">
var request = new XMLHttpRequest();
request.open('GET', 'https://chesspuzzle.net/de/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;
document.getElementById("puzzlePlayers").textContent = result.Players;
document.getElementById("puzzleSite").innerHTML = result.Site;
}
};
request.send();
</script>