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
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
function compteClics() {
$.ajax({
url : 'compteur.php',
type : 'GET',
async: false,
data : 'r=' + Math.random(),
dataType : 'html',
success:function(data){
nbTel();
},
error:function(message){
alert( "Erreur 1: " + message.responseText );
}
});
}
function nbTel() {
$.ajax({
url : 'getcompteur.php',
type : 'GET',
async: false,
data : 'r=' + Math.random(),
dataType : 'html',
success:function(data){
$('#xfois').html(data);
},
error:function(message){
alert( "Erreur 2 : " + message.responseText );
}
});
}
</script>
<body onload="nbTel()">
<form action="url/2018.pdf" onsubmit="compteClics(); return true;">
<input type="submit" value="télécharger"/>
<span>Téléchargé <span id="xfois"></span> fois</span>
</form>
</body> |