diff options
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(); + })); +} |
