-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
51 lines (47 loc) · 1.54 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chord Progression Generator</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
}
</style>
</head>
<body>
<h1>Chord Progression Generator</h1>
<label for="genre">Select Genre:</label>
<select id="genre">
<option value="pop">Pop</option>
<option value="rock">Rock</option>
<option value="jazz">Jazz</option>
</select>
<button onclick="getChordProgression()">Generate Chord Progression</button>
<div id="result">
<!-- The chord progression will be displayed here -->
</div>
<script>
async function getChordProgression() {
const genre = document.getElementById('genre').value;
try {
const response = await fetch('/generate-chords', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ genre: genre })
});
const data = await response.text();
// https://www.geeksforgeeks.org/how-to-handle-newlines-in-json/
document.getElementById('result').innerText = JSON.parse(data);
} catch (error) {
console.error('Error:', error);
}
}
</script>
</body>
</html>