How to make display the statistics of clicks on the button?

The crux of the matter is that statistics show immediately (before you click). Now everything is Vice versa, first press the down and a message appears indicating how many times it clicked.
I mean come on site, and immediately see how many times clicked :))
In detail how it is implemented:
in index.html
<script type="text/javascript">
$(document).ready(function(){
$('#btn').click(function() {
$.ajax({
 url: "buttom.php",
 cache: false,
 type: 'Get',
data:{book:1},
success:
function(count){
 $('#countinfo').html(count+" test!");
}
});
});
 });/*end ready*/
 </script>


In php:
<?php
if ($_GET['book']==1) {
$file=fopen('data.txt','a+');
flock($file,LOCK_EX);
$count=fread($file,100);
$count++;
ftruncate($file,0);
fwrite($file,$count);
flock($file,LOCK_UN);
fclose($file);
echo $count;
};?>


and displays it all simple:
<div id="countinfo"></div>
June 26th 19 at 14:18
1 answer
June 26th 19 at 14:20
Get the click event and you will have joy
can you highlight where? - adrian_Roob commented on June 26th 19 at 14:23

Find more questions by tags HTMLPHPJavaScript