function update(msg) {
	
	// show message
	if (msg != undefined) {
		alert(msg);
	}
	
	// reload page
	window.location.reload();
}


function acceptSuggestion(id) {
	$.ajax( {
		type: 'GET',
		url: baseUrl+'players/ajax-accept-suggestion/id/'+id+'/',
		success: function(response) {
			update();
		}
	});
}


function denySuggestion(id) {
	$.ajax( {
		type: 'GET',
		url: baseUrl+'players/ajax-deny-suggestion/id/'+id+'/',
		success: function(response) {
			update();
		}
	});
}


function acceptRequest(id) {
	$.ajax( {
		type: 'GET',
		url: baseUrl+'players/ajax-accept-invitation/id/'+id+'/',
		success: function(response) {
			update();
		}
	});
}


function denyRequest(id) {
	$.ajax( {
		type: 'GET',
		url: baseUrl+'players/ajax-deny-invitation/id/'+id+'/',
		success: function(response) {
			update();
		}
	});
}
