how to make link count value ready to UPDATE mysql database.table
For this question I use almost the same example taken from this topic.
- <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Click Counter</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('body').on('click', 'a', function(event){
var currentNumber = $('#currentNumber').text();
$.ajax({
method: 'POST',
url: 'counter.php',
data: {currentNumber : currentNumber}
})
.done(function(newNumber){
$('#currentNumber').text(newNumber);
});
});
});
</script>
</head>
<body>
<center>
<br><br><br><br>
<div id="currentNumber">0</div>
<!--
<button type="button">Click To Add One</button>
-->
<a href="https://www.jquery.com" target="_new">https://www.jquery.com</a><br>
</center>
</body>
</html>
.
For me it is unclear how to get the $_POST['currentNumber'] from the php script in a way I can send it with mysql queries to the database.
Am I right that the jquery part here is only capable of adding a value to the post value $_POST['currentNumber'] ?
And am I right that if I want to send the same counter value to the database table I should deliver it in another way? If so, can someone explain how this data can be send to PHP to make a database entry?