Если вы действительно хотите сделать счетный номер, используя ajax, позвоните вот пример:
counter. php:
<?php
$counter = $_GET['current_value'] + 1; //value is increase here
echo json_encode(['new_value' => $counter]); //return the value in JSON format
?>
Ваш HTML Файл:
<span class="points-count">0</span>
<button onclick="count()">Increase</button>
<script type="text/javascript">
function count() {
$.ajax({
url : "counter.php",
type : "GET",
dataType: "json",
data : {
current_value: $(".points-count").html() //set value here
},
success: function(data) {
$(".points-count").html(data.new_value); //finally, get the returned value of the php script
}
});
}
</script>