I have a html script with a javascript variable inside it, this variable I have then passed to a php file, to increment it by 1. My problem is that I don't know how I would then pass it back to the html file, to then display it, also I don't know how the variables work on a website, if I have to save the variable in some sort of way to make sure it is the same updated variable as when I left the site.
html script:
<script type="text/javascript">
var nrVar= 1;
document.getElementById("nrVar").innerHTML = nrVar;
document.getElementByID("nrVar").value = nrVar;
</script>
php script:
<?php
$nrVar= $_POST['nrVar'];
$nrVar= round((int)$nrVar+1);
?>
AJAX
– Daan Mar 27 at 15:20