You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.8 KiB
PHTML
50 lines
1.8 KiB
PHTML
2 years ago
|
<x-layout>
|
||
|
<x-slot name="scripts">
|
||
|
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||
|
|
||
|
<script>
|
||
|
window.addEventListener('DOMContentLoaded', () => {
|
||
|
document.getElementById('fetchAchievements').addEventListener('click', function() {
|
||
|
var username = document.getElementById('username').value;
|
||
|
var gameId = document.getElementById('game_id').value;
|
||
|
|
||
|
axios.post('/achievements', { username, game_id: gameId })
|
||
|
.then(function(response) {
|
||
|
var achievementsResult = document.getElementById('achievementsResult');
|
||
|
achievementsResult.innerText = JSON.stringify(response.data, null, 2);
|
||
|
})
|
||
|
.catch(function(error) {
|
||
|
console.error(error);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
</script>
|
||
|
</x-slot>
|
||
|
<x-slot name="title">Achievement Test</x-slot>
|
||
|
|
||
|
<x-slot name="content">
|
||
|
|
||
|
<div class="container px-4 mx-auto mt-20 ml-20">
|
||
|
<div class="flex flex-col my-10 lg:flex-row">
|
||
|
<form id="achievementsForm">
|
||
|
<div>
|
||
|
<label for="username">Username:</label>
|
||
|
<input type="text" id="username" name="username">
|
||
|
</div>
|
||
|
<div>
|
||
|
<label for="game_id">Game ID:</label>
|
||
|
<input type="text" id="game_id" name="game_id">
|
||
|
</div>
|
||
|
<div>
|
||
|
<button type="button" id="fetchAchievements">Fetch Achievements</button>
|
||
|
</div>
|
||
|
</form>
|
||
|
<div id="achievementsResult"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</x-slot>
|
||
|
</x-layout>
|