I am trying to display 9 last uploaded images through AJAX, but also be able to navigate through past uploaded images as well.
<script language = "javascript" type = "text/javascript">
var x = 0;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
nextButton.onclick = function(){
x+=1;
};
document.getElementById("tst").innerHTML = xmlhttp.responseText;
};
xmlhttp.open("GET", "getImage.php?=" + x , true);
xmlhttp.send();
</script>
#getImage.php file
<?php
$q = $_REQUEST["q"];
$req = intval($q);
echo $req;
?>
I need $req to update every time the button is pressed but also be 0 when the page is loaded so it does not only display the images when the button pressed but also when the page has just loaded Thanks