diff options
| author | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2025-12-06 12:53:43 +0500 |
|---|---|---|
| committer | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2025-12-06 12:53:43 +0500 |
| commit | 4b8ef84059e772ef7636c451356680ec5b0983c4 (patch) | |
| tree | 8cabc9b8c275128fd6582cbd74d36212e49776d6 /static/index.js | |
| parent | 5fd81183f54662fdf08549c0d635e80166c62fe9 (diff) | |
Random song endpoint
Diffstat (limited to 'static/index.js')
| -rw-r--r-- | static/index.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/static/index.js b/static/index.js index 9f5070b..b7056b1 100644 --- a/static/index.js +++ b/static/index.js @@ -1,5 +1,16 @@ + function GetSongs() { fetch("/api/getSongs").then(r => r.json().then(body => { console.log(body); })); } + +function SetRandomSong() { + fetch("/api/randomSong").then(r => r.json().then(body => { + const player = document.getElementById("mainAudio"); + console.log(player); + console.log(body); + player.src = "/api/getSong?name=" + encodeURI(body.Name); + player.play(); + })); +} |
