blob: a74d087e7da859730ecda014144fbc15c4be314b (
plain) (
tree)
|
|
function fetch(url, id) {
var req = new XMLHttpRequest();
req.onload = function() {
var element = document.getElementById(id);
var node = document.createElement("div");
node.innerHTML = this.response;
element.appendChild(node);
};
req.open("GET", url);
req.send();
}
window.onload = function() {
var num_members = 0;
var num_songs = 0;
var add_member_button = document.getElementById('add-member-button');
var add_song_button = document.getElementById('add-song-button');
add_member_button.onclick = function() {
num_members += 1;
fetch('member/new/' + num_members, 'form-members');
};
add_song_button.onclick = function() {
num_songs += 1;
fetch('song/new/' + num_songs, 'form-songs');
};
};
|