1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
   | <body>
<?php $id=1; ?>
	<div class="barre-reseaux-sociaux">
		<button type="button" onclick="traitementVote(1, <?php echo $id; ?>)">1</button>
		<button type="button" onclick="traitementVote(2, <?php echo $id; ?>)">2</button>
		<button type="button" onclick="traitementVote(3, <?php echo $id; ?>)">3</button>
		<button type="button" onclick="traitementVote(4, <?php echo $id; ?>)">4</button>
		<button type="button" onclick="traitementVote(5, <?php echo $id; ?>)">5</button>
	</div>
 
	<script>
		function traitementVote(choixVote, idSite) {
			var xhr = new XMLHttpRequest();
			data="vote="+choixVote+"&id="+idSite;
			xhr.open('POST',votePhP.php);
			xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");     
			xhr.send(data); 
		}		
	</script>
</body> | 
Partager